>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