I would like to compare if two columns are equal in the where clause. The columns are two columns are from different tables that have been joined
This is the statement that I am using
SELECT authors.state, sum(qty*price)as sales_revenue
from authors,titles, stores, sales
WHERE authors.state = (SELECT stores.state from stores)
but I get an error that says this
M
sg 8120, Level 16, State 1, Line 1
Column 'authors.state' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Use this:
Or better, use the ANSI-92 JOIN syntax.