Home All Groups Group Topic Archive Search About

Sql query..... Sum of another aggragate function

Author
24 Apr 2006 8:22 AM
Coool.Net
SELECT     Category, COUNT(Labour_ID) AS LabourCount FROM
HR_Labours
WHERE     (Absconded = '0') AND (VisaCancelled = '0') AND (OnLeave =
'0') AND (Terminated = '0')
GROUP BY Category




here  i reading count of labours under this criteria .... as lzbour
count ..for each category...but
i need the total  count means SUM of labourcout[LabourCount ] ...

i can i write this as SUM(count(Labour_ID))
or ho   i will get the sum...
plz help me

Author
24 Apr 2006 8:37 AM
Cor Ligthert [MVP]
Philip,

As I understand you right, with a command.executescalar

http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbcommand.executescalar(VS.80).aspx

I hope this helps,

Cor

Show quoteHide quote
"Coool.Net" <ismail***@gmail.com> schreef in bericht
news:1145866962.257363.183420@t31g2000cwb.googlegroups.com...
> SELECT     Category, COUNT(Labour_ID) AS LabourCount FROM
> HR_Labours
> WHERE     (Absconded = '0') AND (VisaCancelled = '0') AND (OnLeave =
> '0') AND (Terminated = '0')
> GROUP BY Category
>
>
>
>
> here  i reading count of labours under this criteria .... as lzbour
> count ..for each category...but
> i need the total  count means SUM of labourcout[LabourCount ] ...
>
> i can i write this as SUM(count(Labour_ID))
> or ho   i will get the sum...
> plz help me
>