SQL Server pulling data from multiple tables

advertisements

I'm having a problem trying to pull a specific data from two tables. According to the textbook its:

Select *
From terra..retailsales and terra..retailaccount
Where retailaccountid in retailsales = 2345678
Get date range from = 3/01/2014 to 6/30/2015

However, when running the code it produces an syntax error within the in. Yet to me the whole code looks wrong. Can someone help me. I would like to get this to work in order to do my assignment. It's driving me nuts! I contacted the prof and he said that the code in the book is correct, but I think he's wrong.

Can someone help?


You can JOIN two table, like this:

SELECT *
FROM terra..retailsales RS
     INNER JOIN terra..retailaccount RC
       ON RS.retailaccountid = RC.ID
WHERE RS.retailaccountid = 2345678
     AND [date] BETWEEN '20140301' AND '20150630'