Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
johanna.34
johanna.34
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search