Results 1 to 3 of 3

Thread: Joining

  1. #1
    Join Date
    Mar 2014
    Posts
    1

    Unanswered: Joining

    Hey guys i have a question on an assignment that says :

    6. Display all the names of customers, order year, and total number of orders they have placed in that year.

    So far i got:

    SELECT CustName,YEAR(orderdate), COUNT(orderdate)
    FROM customer,orders
    WHERE orders.orderdate=1997;

    however it is coming out null. Any help?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This line has a mistake:
    orderdate=1997
    1997 is a number, not a date
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    What were the data in tables customer and orders?
    Are there some rows having orders.orderdate=1997?


    Anyway, I doubt that the query worked,
    because, there was an aggregate function COUNT(orderdate) without GROUP BY clause.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •