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 |
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2011-06-29 : 10:17:03
|
| How to find difference(in months) between the most recent and oldest order dates? ia a same columnRegard,Sg |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-06-29 : 10:19:43
|
| SELECT DATEDIFF(month,Oldest,Newest)FROM( select min(orderdate) as Oldest,max(orderdate) as Newest from yourTable)) tJimEveryday I learn something that somebody else already knew |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-06-29 : 11:11:44
|
| orselect datediff(month,min(orderdate) ,max(orderdate)) from yourTableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|