I have the following table, how would I go about returning the number of occurrences of each id that has status=pass
id status
111 pass
111 fail
333 pass
222 pass
333 pass
222 fail
so that the result set would look like this
id num_occurrences
111 1
222 1
333 2
Try this::