Row Counts Based on Distinct Values from Multiple Tables

  • Nevyn, I have attached a picture of the current results I am receiving. It's showing that I am performing 2,736 attn tests on machine 55242278 for the day of 9/26. I think it is adding up all of the combinations for that day. Maybe I am wrong?

    Eirikur,

    Thank you for the additional metrics, its appreciated. I have never used a "Partitioned by" statement before, I will be looking that one up.

    Edit: I have added the attachment "DesiredResults.png" these are the results I am going for.

    Thanks!

    cstg85

  • cstg85 (1/16/2015)


    Nevyn, I have attached a picture of the current results I am receiving. It's showing that I am performing 2,736 attn tests on machine 55242278 for the day of 9/26. I think it is adding up all of the combinations for that day. Maybe I am wrong?

    You ought to be wrong. As long as it groups by all three columns, it should be only giving you the attn's for that day.

    Now, it is not necessarily SORTING the results as you want.

    Try adding "ORDER BY TestDate,SerialNumber,TestType" after the group by clause and see if you get more of the format you want.

    To understand Eirikur's queries, you will need to look up "windowing functions".

  • It worked, the customer is happy. I can't thank you all enough for your assistance. 🙂

Viewing 3 posts - 16 through 17 (of 17 total)

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