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
 Generate new Row After Calculation

Author  Topic 

asif372
Posting Yak Master

100 Posts

Posted - 2013-01-08 : 06:39:09
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
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2013-01-08 : 06:59:42
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
   

- Advertisement -