Reputation: 128
SELECT *
FROM StocksFinancial
IN
(SELECT *
FROM Stocks
WHERE Market_Cap <= 13);
Above is the SQL code that I'm trying to write for a query that should show the financial information of the stock that has a market cap of less than 13. However, I am getting a
Syntax error FROM clause.
I am using Access 2007.
I am new to SQL.
Thanks for your help in advance.
Upvotes: 0
Views: 655
Reputation: 1269563
To use in
you need a where
clause. Your query as written doesn't make sense. It should be something like:
SELECT *
FROM StocksFinancial sf
where sf.stockname IN (SELECT stockname FROM Stocks WHERE Market_Cap<=13);
Upvotes: 0
Reputation: 5722
That doesn't hang together syntactically:
You'd have to do something more like
SELECT * FROM StocksFinancial
WHERE stock_id IN
(
SELECT stock_id
FROM Stocks
WHERE market_cap <= 13
)
The query inside the IN expression must return only one column.
Upvotes: 2