Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Distinct Count of Order Numbers

Status
Not open for further replies.

laurenbattaglia

Technical User
May 3, 2002
28
US
I need to do a Distinct Count on order numbers. I have a table with order_id and line_id. What I need is the number of order with 1 line, 2 lines ect. I am at a loss on the distinct count of order_id.

order_id line_id
1001 1
1001 2
1001 3
1001 4
1002 1
1002 2
1003 1
1004 1
1004 2
1004 3
1004 4
1004 5
1005 1
1005 2
1005 3
1005 4
1006 1
1006 2
1007 1
1007 2
1007 3
1007 4
1007 5
1008 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top