2

I'm trying to update a column in my table "InventoryTable" with the SUM of values returned from Querying my other table "OrderTable"

I found several other questions like this here, and composed this statement:

UPDATE InventoryTable
SET SalesPerMonth = foo.ASPM
FROM InventoryTable
INNER JOIN (
    SELECT InventoryID, SUM(Quantity) AS ASPM
    FROM OrderTable
    GROUP BY InventoryID
) AS foo ON foo.InventoryID = InventoryTable.InventoryID 

I'm using this on OpenOffice Base SQL Edit and I keep getting a syntax error:

Syntax Error in SQL Expression

with these details:

SQL Status: HY000 Error code: 1000
syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE

I cannot figure out what I am doing wrong.

Thank you.

Juan Mellado
  • 14,973
  • 5
  • 47
  • 54
Josh Jeffers
  • 25
  • 1
  • 6
  • Sure Thing. The initial Error pop up is "Syntax Error in SQL Expression" Then it gives me more in the 'details' that looks like "SQL Status: HY000 Error code: 1000" and "syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE" Syntax error in SQL expression – Josh Jeffers Oct 23 '11 at 08:37

0 Answers0