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.
| Author |
Topic |
|
TMDOSS
Starting Member
33 Posts |
Posted - 2008-11-20 : 11:05:56
|
| I have table with Date and Slotid (2008-11-20) and slotid = 1 (I have another table where slot id 1 = 7.00AM2 = 7.30am ext)My problem is now I need to find current datetime - date and slot id time from the tabel I havefor Example if current time is (2008-11-20 11.01 am) - (2008-11-20) & (Time is based on the slot id if slotid is 1 = 7.00 am)so i need to get answer 03.01 as time differencePl Help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-20 : 11:24:55
|
try like thisSELECT DATEDIFF(mi,CAST(t1.Date AS varchar(11)) +' '+ CAST(t2.time AS varchar(4)),GETDATE())/60.0 AS TimeDiffFROM table1 t1JOIN table2 t2ON t1.slotid=t2.slotid |
 |
|
|
|
|
|