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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Count Distinct

Author  Topic 

kprasadreddy
Starting Member

41 Posts

Posted - 2005-04-05 : 12:29:58
How can I do a count of distinct of course numbers and version numbers...

SELECT COUNT(DISTINCT LD075.CRS_NB,ld075.crs_vrsn_nb) FROM ZLDT075_CRRCLM_CRS LD075 INNER JOIN ZLDT030_CRS LD030 ON LD030.CRS_NB = LD075.CRS_NB AND LD030.CRS_VRSN_NB = LD075.CRS_VRSN_NB where LD075.CRRCLM_CD = "&intCrrclm&" AND LD030.CRS_STAT_CD = 1 AND LD075.CRRCLM_TRACK_CD ="&intTrack&" AND (LD075.LOC_CD ='"& strLoc &"' or LD075.LOC_CD ='ZZ')

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-05 : 12:36:31
Try this one:

SELECT COUNT(*) FROM (
SELECT DISTINCT LD075.CRS_NB, ld075.crs_vrsn_nb FROM ZLDT075_CRRCLM_CRS LD075 INNER JOIN ZLDT030_CRS LD030 ON LD030.CRS_NB = LD075.CRS_NB AND LD030.CRS_VRSN_NB = LD075.CRS_VRSN_NB where LD075.CRRCLM_CD = "&intCrrclm&" AND LD030.CRS_STAT_CD = 1 AND LD075.CRRCLM_TRACK_CD ="&intTrack&" AND (LD075.LOC_CD ='"& strLoc &"' or LD075.LOC_CD ='ZZ')) A
Go to Top of Page
   

- Advertisement -