Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too Few Parameters -- Expected 1. 1

Status
Not open for further replies.

milton747

Programmer
Apr 21, 2005
133
US
I get: Too Few Parameters -- Expected 1.
TOT3 is suumming the all order values with a city.
Any assistance. My SQL skills are light I'm afraid.
Milt.



SELECT
OrdersByCity.city, OrdersByCity.orderID,
(OrdersByCity.pricequote * OrdersByCity.quantity) As TOT2,

(SELECT SUM(TOT2)
FROM OrdersByCity T1
WHERE T1.city = OrdersByCity.city) AS TOT3

FROM OrdersByCity
ORDER BY
OrdersByCity.city,
OrdersByCity.orderID

-- End ---

 
You can't use alias with aggregate functions. Try this:

Code:
SELECT
OrdersByCity.city, OrdersByCity.orderID,
(OrdersByCity.pricequote * OrdersByCity.quantity) As TOT2,

(SELECT SUM(t1.pricequote * t.quantity) as TheSum
FROM OrdersByCity T1
WHERE T1.city  = OrdersByCity.city) AS TOT3

FROM OrdersByCity
ORDER BY
OrdersByCity.city,
OrdersByCity.orderID

~Melagan
______
"It's never too late to become what you might have been.
 
Thanks Melagan.
I just tried the SQL and it works good in my report.

Big Thanks.
Milt.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top