0

I need to find how many times each value occurs, although I need to only display the values that occur 4 or more times. I know how to find the number of times a value occurs, but I don't know the second half. Here is an example of my data.

id | Order id
--------------
191 | 1020
150 | 1090
191 | 1023
140 | 1033
191 | 2132
191 | 1233
191 | 1321

I want to output something like this

ID  | Occurrences 
---------------
191 |  5

Hope that makes sense. Thanks

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
  • 3
    Please don't change the question, especially when it's already been answered and answered correctly. – peterm Aug 15 '13 at 01:12

1 Answers1

1

Try this

SELECT id , COUNT(Order id) FROM YourTable
GROUP BY id
HAVING COUNT(Order id) > 4
bvr
  • 4,786
  • 1
  • 20
  • 24