how to get unique combination of 3 columns as well as count? thanks...

  • hi, my report structure should be like this:

    count

    low med high

    ColA colB colC

    country state city

    col A col B col C have hierarchy with col c being the deepest level.

    I have a field as field.amount value that gets me the actual amount.

    under

    low med high,

    count of the amount that is <100 $, >100 and <200 and >200

    but I need a count of how many times for a particular country state and city combination the amount was

    LOW ie <100$ or

    MEDIUM >100 and <200 or

    HIGH >200 respectively

    Some places city is null or state is null....

    In query how do I get count unique combination of these 3 col A, B C columns and occurance/count of field.amount value (low or med or high) for this unique combo as well as Sum of count...

    very confused ..please help.

    Thanks

  • Much like all the other threads you have posted over the last several days you continue to miss to most important piece of getting help. You have to help us help you. You have been directed multiple times to the article which is also in my signature. Please read it and understand how to post your questions. None of us are mind readers and we do not get paid for our services here.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

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

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