dotnetdevcsharp
dotnetdevcsharp

Reputation: 3980

MS ACCESS 97 QUERY

I need to do a very simple select sum on orders table but its bringing back count of 82 locations when their is only one location for the first data

SELECT Orders.OrderNumber, sum(Orders.Location)
FROM ORDERS
GROUP BY  Orders.OrderNumber,Orders.Location

enter image description here

What am I missing in such a basic query ?

Upvotes: 1

Views: 146

Answers (2)

Vignesh Kumar A
Vignesh Kumar A

Reputation: 28403

You don't need Orders.Location in Group By Clause

Try this

SELECT Orders.OrderNumber, sum(Orders.Location)
FROM ORDERS
GROUP BY  Orders.OrderNumber

Upvotes: 0

ron tornambe
ron tornambe

Reputation: 10780

You need to remove the Group By on Location:

SELECT Orders.OrderNumber, Sum(Orders.Location) AS SumOfLocation
FROM Orders
GROUP BY Orders.OrderNumber;

Upvotes: 4

Related Questions