MySQL Query Troubles

I am trying to build a query in MySQL to get test results from a tester. So essentially, I have a table with IDs, SerialNumbers, and TestResults. The ID is the primary key in this, and is just a char(38) key. The Serial Numbers are a string that represents the item’s SN, and can be duplicated multiple times, as an item is tested multiple times. The Test Results contain strings that state the result of the test, such as “Passed”, “Failed”, “Error”, and “Terminated”. All I want to do is set a SELECT query where it is grouped by serial number, with the count of passes, the count of fails, the count of errors, and the count of terminations for each serial number. I can’t seem to find a clean way to do this in one single query. Can anyone help?

submitted by /u/DairySniper
[link] [comments]


Go to Source of this post
Author Of this post: /u/DairySniper
Title Of post: MySQL Query Troubles
Author Link: {authorlink}