I would like to make a select statement, using a select distinct, and include a count in each record returned.
For example, for the dataset below, I would like the record to return only 1 instance of the "order number" and a count of how many different ones there are.
Can someone help with this? Thank you.
I would like the return to show this, from the dataset below it.
Query return:
Order Number | Count
1234567 3
7896548 1
Data set:
ID | Order Number
1 1234567
2 1234567
3 1234567
4 7896548
This one is slightly different.. I always use the Field Name in the count function instead of *. Not sure if * will work on all database systems.
Select orderNumber,Count(orderNum
from table
GRoup BY orderNumber