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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-02-11 : 02:42:14
|
| how can i select all records from my table where date2 is more then 2 days from date1 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-11 : 02:50:25
|
[code]select *from mytablewhere datediff(day, date1, date2) > 2select *from mytablewhere date1 < dateadd(day, -2, date2)[/code] KH |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-02-11 : 03:04:40
|
| thanks.. now to make this more confusinghow can i do where the difference betweenmydate from mytable1 is more then 2 days then select mydate1 from table2 where pid=id |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-11 : 03:35:47
|
| select t1.*from table1 as t1inner join table2 as t2 on t1.id = t2.pidwhere t1.date <= t2.date - 2Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|