Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 two row data into one row

Author  Topic 

pnasz
Posting Yak Master

101 Posts

Posted - 2012-05-02 : 01:59:57
EmpID Name Date On duty Off duty Clock In Clock Out
1494 John 30/04/2012 09:00 12:00 09:17
1494 Steve 30/04/2012 17:00 21:00
1494 Pat 01/05/2012 09:00 12:00
1494 Jim 01/05/2012 17:00 21:00

i have data in for employee with two shift in sql table
is it possible to put the data from one table to new table in this format


EmpID Name DAte OnDuty1 OffDuty1 Onduty2 offduty2 clockin1 clockout1 clockin2 clockout2
1494 john 30/04/2012 09:00 17:00 17:00 21:00 09:17


please help

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2012-05-02 : 09:57:47
can you please do the proper formatting of your table and required result . write your question between Insert code button.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-02 : 19:28:05
so upto how many level you've show us columns? what if there are more than 2 rows for a Employee?
also didnt understand how same employeeid can have different names against it



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -