I am still pretty new to writing SQL statements and I have mostly used MS Access up until now.
My question is I am trying to write a single query based on the sample table below to determine how many orders were all parts orders, how many were all accessories orders, and how many were mixed orders. Can anyone help me out to see how to do this?
OrderNum, OrderLineNum, ProductNum, ProductTypeNum, ProductType
--------------------------------------------------------------------------------------------
38881074, 167204588, 999998, 31, parts
38881074, 167204590, 957881, 35, parts
38881074, 167204589, 10451035, 22, parts
38881075, 167204591, 421305, 24, parts
38881077, 167204592, 942719, 21, parts
38881079, 167204594, 10718820, 31, parts
38881081, 167204595, 10534431, 33, accessories
38881082, 167204599, 10678891, 21, parts
38881083, 167204598, 952423, 26, parts
38881083, 167204600, 1137236, 91, parts
38881083, 167204596, 10547425, 31, parts
38881083, 167204597, 10738102, 31, parts
38881084, 167204602, 3033669, 33, accessories
38881084, 167204601, 10031883, 24, parts
38881085, 167204603, 10542026, 35, parts
38881086, 167204614, 10139740, 35, parts
Just to explain the table, each order is assigned a OrderNum. An OrderNum can have multiple multiple orderlines (OrderLineNum) assigned to it depending on the number of products orders, one per each product ordered. Each OrderLineNum is unique. The ProductNum field is the product number and represents something that the customer bought. ProductTypeNum represent a type or class of products, everything but type 33 is a part. Type 33 is accessories.
Thank you for your help!