several lines and kind of datas to one line and different columns

  • Hello,

    I need to affect datas from two differents line to one line.

    Let s imagine

    ***ORDERS TABLE

    ID Name adress

    --------------------

    01 AA adr1

    02 BB adr2

    03 CC adr3

    ****LINEORDERS TABLE

    ID IDorder IDprofileType ProfileType idPers

    -------------------------------------------------------------

    01 01 01 Organizer 0045

    01 01 02 Present 0085

    01 01 02 Present 0032

    01 01 03 Manager 0018

    Lets imagine we want as result >

    ***RESULT TO GET

    IDorder NameOrder OrganizerID PresentID ManagerID Diff

    -------------------------------------------------------------------------------------------

    01 AA 0045 0085 0018 yes

    01 AA 0045 0032 0018 yes

    Diff is yes if managerID and organizerID are different.

    How can I do to have such a result.

    Do I need to create in tsql temporary tables .. what would be the lighter

    I have a lot of lines in the table.

    Thanks for your help

Viewing 0 posts

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