SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 two row data into one row
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pnasz
Yak Posting Veteran

89 Posts

Posted - 05/02/2012 :  01:59:57  Show Profile  Reply with Quote
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

India
311 Posts

Posted - 05/02/2012 :  09:57:47  Show Profile  Reply with Quote
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

India
47099 Posts

Posted - 05/02/2012 :  19:28:05  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000