SQL Query Help

access United States
  • 14 years ago

    Please could you help me with the following query which will be based on a report.

    Create a report which shows how many of each type of sandwich are required for that day. You will need to run a query which joins the Orders and Orderline tables to find all orders with a delivery date of today (using a parameterised query) and then find all Orderlines for these Orders. GROUP BY SandwichNo and calculate how many of each sandwich type need to be made (use SUM(Quantity) in the SQL statement). You do not need to display the name of each sandwich as the sandwich maker is familiar with the SandwichNos. Format the report to allow the sandwich maker to produce the required amount of sandwiches of each type.

    My tables for this query

    Orders

    OrderNo (pK)
    CustomerNo
    DateOfOrder
    DeliveryDate
    CostOFOrder
    Delivery Address1
    Delivery Address2
    City
    County
    Post Code








    Orderline


    OrderNo (PK)
    SandwichNo (PK)
    Quantity


  • 14 years ago

    Hi,

    Check this:

    SELECT OrderLine.SandwichNo, Sum(OrderLine.Quantity) AS SumOfQuantity
    FROM [Order] INNER JOIN OrderLine ON Order.OrderNo=OrderLine.OrderNo
    WHERE (((Order.DeliveryDate)=Date()))
    GROUP BY OrderLine.SandwichNo


     

    Hope this works for you

  • 14 years ago
    Thanks, still not working, im getting an error that it says an synax error in join opperation.
  • 14 years ago
    I got it working now, but its not showing a parameterised query to show the dates of all the delivery dates of today.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic