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)
 SQL Aggregate sum

Author  Topic 

kprasadreddy
Starting Member

41 Posts

Posted - 2004-08-25 : 19:54:23
SELECT COUNT(STDNT_NB),
LDV180.LOC_CD

FROM ZLDV180_STDNT_PASSING LDV180
WHERE LDV180.CRRCLM_CD = 4
AND LDV180.LOC_CD IN ('OM','ME','LI')
AND LDV180.STDNT_EMPLR_CD IN (1,99)
WHERE LDV180.CRS_NB IN (SELECT CRS_NB FROM ZLDT075_CRRCLM_CRS WHERE CRRCLM_CD =9 AND CRRCLM_TRACK_CD =80)
GROUP BY LDV80.LOC_CD

hOW DO i GET the count of students who have taken any of the courses from the inner query.

Please help

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-25 : 20:00:01
Could you provide an example?

Tara
Go to Top of Page

kprasadreddy
Starting Member

41 Posts

Posted - 2004-08-25 : 20:01:25
When I use this inner query I get an error.

WHERE LDV180.CRS_NB IN (SELECT CRS_NB FROM ZLDT075_CRRCLM_CRS WHERE CRRCLM_CD =9 AND CRRCLM_TRACK_CD =80)
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-25 : 23:24:04
[code]
SELECT
COUNT(STDNT_NB),
LDV180.LOC_CD
FROM
ZLDV180_STDNT_PASSING LDV180
WHERE
LDV180.CRRCLM_CD = 4
AND LDV180.LOC_CD IN ('OM','ME','LI')
AND LDV180.STDNT_EMPLR_CD IN (1,99)
AND LDV180.CRS_NB IN (
SELECT CRS_NB
FROM ZLDT075_CRRCLM_CRS
WHERE CRRCLM_CD =9 AND CRRCLM_TRACK_CD =80)
GROUP
BY LDV80.LOC_CD
[/code]

What a naming convention. I think my eyes are going to be sick.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

sagarvt
Starting Member

2 Posts

Posted - 2004-08-26 : 04:28:52
Boss,

give the tables and tell us in brief what u need exactly. i could not understand the naming conventions u have used.

regards
sagar
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-26 : 12:10:17
An example of your data and what the expected result set should look like.

Tara
Go to Top of Page
   

- Advertisement -