sql coding help (hope this is right forum)

  • Hi all,

    I've got this query as seen below,

    now it needs to grab distinct rows

    where the user is distinct.

    This is done where you see "select distinct (select yaddah yaddah yah).

    now the issue is

    if there is 2 users with the same name it only grabs his name once, which is exactly what is needed lol

    but the prob lies with it grabs the rest of his details.

    The issue is with line 24

    If the user occurs twice it only grabs his name once but grabs his details from the other rows that also contain his name.

    Now I can't really do a distinct on the rest of his details as other users can have the same details.

    Hopefully this was enough to explain what I'm trying to do.

    If anyone can assist in this issue, that would be great.

    Thanks

    M@

    insert into name_entry

    (

    ned_id,

    value,

    data_descriptor_id

    )

    select

    distinct (select

    top 1 ned_id

    from

    name_entry_descriptor

    where

    ned_name = data_1

    and

    data_1 <> ''

    and

    data_1 is not null

    and

    client_group_id = 11

    and

    client_id = 1537

    )

    as NED_ID,

    data_1 as value,

    3 as Data_Descriptor_ID

    from

    nameentry

    where

    layoutid in (285,286)

    and

    data_1 <> ''

    and

    data_1 is not null;

    help

  • its all good now, I've dicided to do some coding with my server side language

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply