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-22 : 16:23:54
|
| Hello,Please, I have the following query, and trying to get the distinct records by c.CNID fieldSELECT Top 3 c.ID as Modid,c.CNID,RTRIM(pg.progno) + ' ' + RTRIM(pj.projno)+ ' ' + RTRIM(ctr.contractno) AS description,C.sequenceno as Seq,'CN' as Type,C.UpdatedFROM tab_ccsnetcn_log C INNER JOIN TAB_ccsNetPrograms pg ON C.ProgID = pg.ProgID INNER JOIN TAB_ccsNetProjects pj ON C.ProjID = pj.ProjID INNER JOIN TAB_ccsNetContracts ctr ON C.ContractID = ctr.ContractIDThank you very much for the help. |
|
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-11-22 : 16:37:35
|
| Sorry, I missed the Order by clause with Updated datetime datatype.SELECT Top 3 c.ID as Modid,c.CNID,RTRIM(pg.progno) + ' ' + RTRIM(pj.projno)+ ' ' + RTRIM(ctr.contractno) AS description,C.sequenceno as Seq,'CN' as Type,C.UpdatedFROM tab_ccsnetcn_log C INNER JOINTAB_ccsNetPrograms pg ON C.ProgID = pg.ProgID INNER JOINTAB_ccsNetProjects pj ON C.ProjID = pj.ProjID INNER JOINTAB_ccsNetContracts ctr ON C.ContractID = ctr.ContractIDORDER BY C.Updated DESC |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-11-22 : 16:55:09
|
| We are going to need more information in order to help you. Please provide sample data for each of your tables, DDL for the tables, and the expected result set using the sample data. See X002548's signature link for an example.Tara Kizeraka tduggan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|