SQL Syntax Error

G

Guest

Lynn Trapp asked me to post the actual SQL code so that it can be checked for
error. The error is "Syntax error in FROM clause."

SELECT Stock.Item, Sum(Stock.Quantity),
Sum(Sales.[Item Bought])
FROM Stock JOIN ON Stock.Item = Sales.Item Bought
GROUP BY Stock.Item
 
M

Matthias Klaey

Lynn Trapp asked me to post the actual SQL code so that it can be checked for
error. The error is "Syntax error in FROM clause."

SELECT Stock.Item, Sum(Stock.Quantity),
Sum(Sales.[Item Bought])
FROM Stock JOIN ON Stock.Item = Sales.Item Bought
GROUP BY Stock.Item

SELECT Stock.Item, Sum(Stock.Quantity),
Sum(Sales.[Item Bought])
FROM Stock JOIN Sales ON Stock.Item = Sales.[Item Bought]
GROUP BY Stock.Item

HTH
Matthias Kläy
 
J

John Vinson

Lynn Trapp asked me to post the actual SQL code so that it can be checked for
error. The error is "Syntax error in FROM clause."

SELECT Stock.Item, Sum(Stock.Quantity),
Sum(Sales.[Item Bought])
FROM Stock JOIN ON Stock.Item = Sales.Item Bought
GROUP BY Stock.Item

You're not specifying the SALES table: should be

FROM Stock JOIN Sales ON Stock.Item = Sales.[Item Bought]

You need the name of the table to which you are joining, and if you
(unwisely, IMO) use blanks in fieldnames, you need brackets around the
fieldname.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
D

David Seeto via AccessMonster.com

ARGH! I seem to have wasted my time and effort replying to your initial post - this is why I would ask you to not post the same question multiple times!!! Update your previous post if you need a clarification! :(

*****************************************
* A copy of the whole thread can be found at:
* http://www.accessmonster.com/Uwe/Forum.aspx/access-tablesdbdesign/6314
*
* Report spam or abuse by clicking the following URL:
* http://www.accessmonster.com/Uwe/Abuse.aspx?aid=d437c3ac2b4f4ccfacedc6e67dc65901
*****************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Subtraction 2
Subquery with subraction - challenging 4
SQL 3
Summary query in DLinq 6
SQL Statement 2
WHERE syntax v. JOIN ON syntax 8
Calling Parameterized Query Using SQL Syntax 3
Null in answer. 5

Top