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-11-14 : 02:08:52
|
| For a query like below ... How do i have to select only the latest revisions,if i need to filter last current revisions of each document ...where the revision could be either alphabetical or even numerical ...Presently I get all revisions with the below query ...Note: csd_revi is the field of CSD table for revisions.---select distinctcsd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi as "Document Reference No.",csd1.csd_labl + ' ' as "Description"fromE0437csd csd1,E0437tra tra1,E0437csd csd2,E0437trd trd1,E0437apr apr1,E0437apc apc1,E0437tra tra2,E0437csd csd3,E0437trd trd2wherecsd1.csd_orig = 'BS' andcsd1.csd_subj like '%WN1%' andcsd1.csd_type = 'D' andtra1.tra_drgn = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi andtra1.tra_part = 'PARSO' andtra1.tra_type = 'A' andcsd2.csd_orig + csd2.csd_subj + csd2.csd_type + csd2.csd_numb + csd2.csd_revi = tra1.tra_trno andtrd1.trd_trno = tra1.tra_trno andtrd1.trd_cc = '0' andtrd1.trd_part = 'PARSO' andapr1.apr_docu = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi and(apr1.apr_stat = apc1.apc_code or apr1.apr_stat = '') andtra2.tra_drgn = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi andtra2.tra_part = csd1.csd_ownr andcsd3.csd_orig + csd3.csd_subj + csd3.csd_type + csd3.csd_numb + csd3.csd_revi = tra2.tra_trno andtrd2.trd_trno = tra2.tra_trnoorder bycsd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi---Life is beautiful ... When you smile ... |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-14 : 02:23:55
|
| It would be great if you can post some sample data .. ???Complicated things can be done by simple thinking |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-11-14 : 02:35:01
|
| is this what you want ?select csd1.csd_orig, csd1.csd_subj, csd1.csd_type, csd1.csd_numb, max(csd1.csd_revi) as "Document Reference No.", csd1.csd_labl, as "Description"from <your table list>where <your where condition>group by csd1.csd_orig, csd1.csd_subj, csd1.csd_type, csd1.csd_numb, csd1.csd_labl[KH] |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2005-11-14 : 03:10:14
|
| If you follow this link it tells you what you need to provide so that someone can help you[url]http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx[/url]steve-----------Facts are meaningless. You could use facts to prove anything that's even remotely true! |
 |
|
|
|
|
|
|
|