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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-11-18 : 15:29:32
|
| Can you please tell me.I want to get the last three rows which were modified. using the modified_dt field. which has datetime datatypeselect * from mytable where modified_dt = ;Thank you very much for the info. |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2005-11-18 : 15:32:51
|
| Have a look at the following keywords in BOL:TOPORDER BY |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-19 : 00:18:21
|
| select Top 3 columns from mytable where modified_dt = yourDate order by modified_dt DESCMadhivananFailing to plan is Planning to fail |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-11-19 : 08:14:14
|
quote: Originally posted by minivan select Top 3 <columnList> from mytable where modified_dt = yourDate order by modified_dt DESCMinivanplanning to accord is according to plan
Be One with the OptimizerTG |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-19 : 08:20:40
|
Thats cool MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-11-20 : 02:31:35
|
If you want to then arrange them in ascending order you could do this - inner loop selects the last 3, outer loop rearranges the orderSELECT *FROM( select Top 3 * from mytable ORDER BY modified_dt DESC) XORDER BY modified_dt ASC Kristen |
 |
|
|
|
|
|