Skip to content
Advertisement

How to count SQL based on a DateTime and an other variable?

I have a SQL table with failed testresults:

This table is telling me that the test has failed, but I want to know if it is the first, second or third test. In the end I would like to do it with a logo where a x stands for a failed test, and a X for the concerned test, like this way:

It has to do something with COUNT and SUM, but I couldn’t find out where to start with this case. Can you help me?

Advertisement

Answer

This seems like a weird requirement, but I think this does what you want:

This uses string operations to construct the status string.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement