>>>>order_num, unique_line_no, customer_code... >>>>2345 123456 ABC >>>>2345 123457 ABC >>>>2345 123458 ABC >>>>...... >>>>>>>>what i am trying to do is select out from this table and group by a customer code but show the number of orders that customers has as well as the number of lines. So in this case the customer has 1 order and 3 lines. I thought that something like select distinct(order_num) as cust_num_of_orders would work but to no avail. anyone point me in the right direction please.
>>>select count(distinct Order_Num) as Orders, count(distinct Unique_Line_No) as Lines, >>>Customer_Code from CustomerOrders group by Customer_Code>>
>SELECT customer_code,COUNT(DISTINCT order_num) AS orders, COUNT(*) AS lines; > FROM CustomerOrders; > GROUP BY customer_codelooks (to me) as if it should work