Using Multiple where conditions in the GROUP BY Clause

  • I am getting questions count for each where conditions which satisfies .

    I achieved the result but with using loop and i don't want to use loop.

    Can you guys do the favor

    (QR.MetaDataKeyID=298 AND MV.value = 'a') AND (QR.MetaDataKeyID=44 AND MV.value NOT LIKE '%b%') AND (QR.MetaDataKeyID=44 AND MV.value NOT LIKE '%d%') AND (RepositoryRef=37258)

    (QR.MetaDataKeyID=298 AND MV.value = 'a') OR (QR.MetaDataKeyID=45 AND MV.value LIKE '%b%') AND (QR.MetaDataKeyID=48 AND MV.value NOT LIKE '%c%') AND (QR.MetaDataKeyID=301 AND MV.value = 'd') AND (RepositoryRef=37309)

    (QR.MetaDataKeyID=44 AND MV.value LIKE '%abcd%') AND (RepositoryRef=37258)

    I need grouping on where condition specified with out using loop.

    my output should like this

    condition1 20

    Condition2 30

    Condition3 5

    Thanks

    Ningaraju

  • Please read the first link on my signature about how to post questions.

    If you want people to even try to solve your issue, please post table DDL, sample data and desired output first.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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