#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    4
    Rep Power
    0

    Select same record multiple times


    Hi, my query is like this:

    select a.CODDCN,
    d.ciusmd,
    b.ARTDCA,
    d.NMISMD,
    QSFSMB,
    ARMSMB from swapfilio.gefcn a join swapfilio.gefca b
    on a.SOCDCN = b.SOCDCa
    and a.CODDCN = b.CODDCA
    join swapfilio.gesmb c
    on b.SOCDCa = c.SOCSMB
    and b.ARTDCA = c.NIISMB
    and b.MODDCA = c.MODSMB
    and b.EMBDCA = c.EMBSMB
    and b.GFMDCA = c.GFMSMB
    join swapfilio.gesmd d
    on c.SOCSMB = d.SOCSMD
    and c.NIISMB = d.NIISMD
    where c.SRGSMB = ' '
    and c.trgsmb = ' '
    and c.sibsmb = ' '

    And one example of the result is:

    2697381 ATACAND 16MG 56COMP 71 LISTA FEV12

    and should be:

    2697381 ATACAND 16MG 56COMP 71 LISTA FEV12
    2697381 ATACAND 16MG 56COMP 71 LISTA MAR12
    2697381 ATACAND 16MG 56COMP 71 LISTA ABR12
    2697381 ATACAND 16MG 56COMP 71 LISTA MAI12
    2697381 ATACAND 16MG 56COMP 71 LISTA JUN12

    another example is:

    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA MAR12
    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA JUN2012

    and shoud be:

    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA MAR12
    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA ABR12
    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA MAI12
    3775285 DETRUSITOL RETARD 2 MG 14 CAPS. 0 LISTA JUN2012

    the max is always LISTA JUN2012 (CODDCN), but i canīt do a thing like <= 'LISTA JUN2012', because the order is alphanumeric.

    thank you
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,927
    Rep Power
    378
    I have no idea what you're talking about.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    4
    Rep Power
    0
    ???? what you donīt understand
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,927
    Rep Power
    378
    For instance, how does...

    Code:
    2697381 ATACAND 16MG 56COMP 71 LISTA FEV12
    become...
    Code:
    2697381 ATACAND 16MG 56COMP 71 LISTA FEV12
    2697381 ATACAND 16MG 56COMP 71 LISTA MAR12
    2697381 ATACAND 16MG 56COMP 71 LISTA ABR12
    2697381 ATACAND 16MG 56COMP 71 LISTA MAI12
    2697381 ATACAND 16MG 56COMP 71 LISTA JUN12

IMN logo majestic logo threadwatch logo seochat tools logo