Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

several lines and kind of datas to one line and different columns Expand / Collapse
Author
Message
Posted Thursday, October 25, 2012 1:01 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 25, 2012 3:32 AM
Points: 1, Visits: 1
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

Post #1376804
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse