will this query alternative to join (simple) work?

the link is http://www.sqlcommands.net/sql+join/

i would like to know if it would work if it were

SELECT Weather.City
FROM Weather
WHERE Weather.City = State.City

meaning select all those cities "from weather" which belong in the state table

will the above work if not then why?

Answers


or, as an alternative (using yr english sentence as a guide):

SELECT City                -- select all those cities
FROM Weather               -- "from weather"
Where City In              -- which 
  (Select City From State) -- belong in the state table

No because to use State.City, the table State needs to be somewhere in the FROM list.

The alternate to the example you provided would be:

SELECT Weather.City
FROM Weather
INNER JOIN State
ON Weather.City = State.City

Your query won't work because the table State does not appear in the FROM clause so you can't reference its columns.

This would work though:

SELECT Weather.City
FROM Weather
JOIN State
ON Weather.City = State.City

Need Your Help

In js.class, is it possible to call other functions from the super class

javascript oop js.class

I'm using js.class and i want to be able to call functions of super class in the sub class. I know i can use this.callSuper() to call the current overridden function from the super class but what a...

Find and replace in text files using AppleScript

file text replace find applescript

I am trying to write an applescript which will run via a launch agent. What the script needs to do is edit a user preference plist file so that default save locations are specific to that user. I am