I am having problems with queries again - (I need a decent book on SQL -
any recommendations?).
I have query that (in a simplified version) does;
SELECT Teacher, Students, OtherStuff, Count(MaleFemale) As
NumberOfGirls
FROM MySchoolTable // a table listing teachers, students
WHERE MaleFemale = 'Girl'
GROUP BY (Teacher)
This would return a list of teachersand the number of girls they have
teacher | girls
----------------------------
Mr X, 14
Mrs Y, 20
which is the number of girls
probablm is that I want the result set to return the number of girls
_and_ boys - ie:
teacher | girls | boys
----------------------------
Mr X, 14, 16
Mrs Y, 20, 10
Can I do something like
... Count(MaleFemale) As NumberOfBoys where MaleFemale = Boy?
If any one is interested the actual table looks like:
SELECT CadID, Cads.PcbID, Cads.LastCollection, Count(SeqNO) As
CollCount
FROM Telfiles LEFT OUTER JOIN Cads
ON Telfiles.cadid = cads.cadid
WHERE FileType < 70
GROUP BY cadiD, PCBID, LastCollection
BTW - thanks for the help on the my previous query of queries as the
responses were very useful.
Grant Black
Software Developer
SmartMove (NZ) Ltd
Phone: +64 9 361-0219 extn 719
Fax : +64 9 361-0211
Email: [EMAIL PROTECTED]
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz