I have the following query using INTERSECT and I can’t figure out how to translate it to MySQL using INNER JOIN.
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location1' AND Date='Date1'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location2' AND Date='Date2'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location3' AND Date='Date3'
Can anyone give me a hand?
You might need to use
SELECT DISTINCTbut I can’t tell because I don’t know your table structure, unique constraints, etc.Re your cryptic comment: I tried the following script in my test database:
The output is this: