new to sql

  • JOBPKGa/msourcetest ZIPpickcount

    16394AALL 000410

    16394AABDALL TX 7511335

    16394AMBDALL TX 75111

    16394AASAMAR TX 7901911

    16394AMSMID TX 7971810

    16399AALL 000420

    16399AABDALL TX 75113310

    16399AMBDALL TX 75112

    16399AASAMAR TX 7901922

    16399AMSMID TX 7971820

    now how can I first group by job and then zip and then get combine record of pick and count if and zip and souce same what is something look like this

    JOBPKGsourcetest ZIPpickcount

    16394AALL 000410

    16394AABDALL TX 7511346

    16394AASAMAR TX 7901911

    16394AMSMID TX 7971810

    16399AALL 000420

    16399AABDALL TX 75113412

    16399AASAMAR TX 7901922

    16399AMSMIDL TX 7971820

    thank you

  • SELECT

    JOB

    ,ZIP

    ,SUM(pick) AS PickTotal

    ,SUM([count]) AS CountTotal

    FROM

    YOUR TABLE NAME HERE

    GROUP BY

    JOB

    ,ZIP

    ORDER BY

    JOB

    ,ZIP

    [font="Courier New"]Looking for a Deadlock Victim Support Group..[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply