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
 Generate new Row After Calculation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

asif372
Posting Yak Master

Pakistan
100 Posts

Posted - 01/08/2013 :  06:39:09  Show Profile  Reply with Quote
My Data is Like this

ID; TimeIn; TimeOut;
1; 9:00; 12:00;
1; 5:00; 6:00;

I want to Generate a mid Row my Required Data is like this

ID; TimeIn; TimeOut;
1; 12:00; 5:00;

How can it be Possible
Thanks in Advance

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3383 Posts

Posted - 01/08/2013 :  06:59:42  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
I suspect you need to define what you want a bit more precisely but

insert tbl
select t1.id, t1.timeout, t2.timein
from tbl t1
join tbl t2
on t1.id = t2.id
and t1.timein < t2.timein

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
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