• you can use a technique using SUM(CASE... to get subtotasl;

    you'll have to construct the multiple case statements to match your descriptions, i think.

    here's a prototype based on the query you posted.

    SELECT

    cc.ResidencyZip AS ZIP,

    COUNT(e.EthnicityDesc) AS 'Record Count',

    SUM(CASE WHEN e.EthnicityDesc = 'White' THEN 1 ELSE 0 END) AS BENCOUNT1,

    SUM(CASE WHEN e.EthnicityDesc = 'Black' THEN 1 ELSE 0 END) AS BENCOUNT2,

    SUM(CASE WHEN e.EthnicityDesc = 'Asian' THEN 1 ELSE 0 END) AS BENCOUNT3,

    CONVERT(DECIMAL(18,2),1.0 * COUNT(e.EthnicityDesc)/COUNT(cc.ChildPartyID) * 100) AS 'Percentage'

    FROM CaseChild cc

    INNER JOIN Party p

    ON cc.childPartyID = p.partyID

    INNER JOIN Ethnicity e

    ON p.EthnicityID = e.EthnicityID

    WHERE (cc.programID = 6)

    GROUP BY cc.ResidencyZip

    ORDER BY cc.ResidencyZip

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!