How to combine two different rows of data

  • I am trying to figure out how to combine two rows of data. I need to combine them because each row is a part of a whole and I eventually need to figure out totals and percentages.

    For example - my current output from my detail data summarizes data for a facility and unit. Each row for that facility unit combinations is part of a whole. For facility,unit(1,10) I have one row of data for the L counts (1)and one row for the S counts (1). I need to get those on the same line so I can say that there is a total of two. And then I can hopefully say that, of that two, 50% is of the L count and 50% is of the S count. Same thing for facility/unit 1/2. There is a total of 8. 3 is part of that, then 5 is the other part. Etc. Etc.

    Thanks in advance for your suggestions.

    My Current Query:

    select facility , unit, form, count(*) as lcount

    from allfacilities

    group by facility, unit, form

    sample of data:

    facility,unit,LongOrShort,Count

    1,10,L,1

    1,10,S,1

    1,2,L,3

    1,2,S,5


    Kindest Regards,

    Patrick Allmond
    batteryfuel.com
    For all of your laptop, camera, power tool and portable battery needs.

  • I think you need to use the Case method to make a cross-tab sum. Check out

    http://www.aspfaq.com/show.asp?id=2462

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

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