QUERY DESIGN PROBLEM

  • Thread starter jonathan.cohen150887
  • Start date

J

jonathan.cohen150887

Hi,

Ok, I have one query that need doing for a project at uni. Problem is
this module is compulsory even though we are finance students and for
most of us programming has never been a part of our lives lol

Basically I have the following query to do:

-Find the customer who has spent the most

Now here are my table schemas in relation to that query:

Customer orders {Customer order reference#, Customer reference,
Shipping address reference, Order Date, Delivery method reference,
Total amount owed}

Now basically i have to sum the amounts owed by each customer(they can
have multiple orders) and display the customer reference that has
spent the most.

Could anyone help me or give me some pointers? Thanks

PS: I ahve done the following but something is missing:


SELECT TOP 1 CUSTOMER_Ref
FROM CUSTOMERORDERS
GROUP BY CUSTOMER_Ref
ORDER BY SUM(CO_TOTALAMOUNT) DESC
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top