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 |
|
nssjari
Starting Member
46 Posts |
Posted - 2005-06-27 : 02:34:28
|
| SQlselectcsd_orig, csd_subj, csd_type, csd_numb, csd_revifrom e0362csdwhere csd_subj='SIBP' and csd_type='D' and csd_numb='0002'ResultsCSD_ORIG, CSD_SUBJ, CSD_TYPE, CSD_NUMB, CSD_REVIBS , SIBP , D , 0002 , 0BS , SIBP , D , 0002 , 1BS , SIBP , D , 0002 , 2Out of this records I need to display only a record with last revision '2'May I know how do i do that ... with the above query ...Please do reply as soon as possible ... Thanks in advanceJariComputer Engg |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-06-27 : 02:50:22
|
selectcsd_orig, csd_subj, csd_type, csd_numb, MAX(csd_revi)from e0362csdwhere csd_subj='SIBP' and csd_type='D' and csd_numb='0002'GROUP BY csd_orig, csd_subj, csd_type, csd_numbAndyBeauty is in the eyes of the beerholder |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-27 : 02:58:45
|
| [code]Select top 1 * from (csd_orig, csd_subj, csd_type, csd_numb, csd_revifrom e0362csdwhere csd_subj='SIBP' and csd_type='D' and csd_numb='0002') T order by csd_revi Desc[/code]MadhivananFailing to plan is Planning to fail |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-07-06 : 13:53:51
|
quote: Originally posted by madhivanan
Select top 1 * from (csd_orig, csd_subj, csd_type, csd_numb, csd_revifrom e0362csdwhere csd_subj='SIBP' and csd_type='D' and csd_numb='0002') T order by csd_revi Desc MadhivananFailing to plan is Planning to fail
Error Will RobinsonSelect top 1 csd_orig, csd_subj, csd_type, csd_numb, csd_revifrom e0362csdwhere csd_subj='SIBP' and csd_type='D' and csd_numb='0002'order by csd_revi Desc [/code] |
 |
|
|
|
|
|
|
|