I tried running a query last night to find all the Dramas I’ve completed with a score >8.5 and whose Genre was either Romance (ID 21) or Romcom (ID 22). This was the SQL generated by building the query in Design View
SELECT "tDramas"."TITLE", "tCountries"."COUNTRY", "tDramas"."SCORE", "tSTATUS"."Status", "tGenre"."GENRE", "tDrama-Genre"."Drama-ID" FROM "tDramas", "tCountries", "tSTATUS", "tDrama-Genre", "tGenre" WHERE "tDramas"."COUNTRY" = "tCountries"."Country-ID" AND "tDramas"."STATUS" = "tSTATUS"."Status-ID" AND "tDrama-Genre"."Drama-ID" = "tDramas"."ID" AND "tDrama-Genre"."Genre-ID" = "tGenre"."ID" AND ( "tDramas"."SCORE" > 8.75 AND "tSTATUS"."Status" = 'completed' AND "tDrama-Genre"."Genre-ID" = 21 OR "tDrama-Genre"."Genre-ID" = 22 )
And this was the output:
As shown, it is selecting the 21 or 22, but is ignoring the >8.5 criterion. In Design View, it looks like this:
The reason I posted the Design View shot was because looking at the Design View I wondered what would happen if tried removing one of the two “OR” criteria. The result was this:
SELECT "tDramas"."TITLE", "tCountries"."COUNTRY", "tDramas"."SCORE", "tSTATUS"."Status", "tGenre"."GENRE", "tDrama-Genre"."Drama-ID", "tDrama-Genre"."Genre-ID" FROM "tDramas", "tCountries", "tSTATUS", "tDrama-Genre", "tGenre" WHERE "tDramas"."COUNTRY" = "tCountries"."Country-ID" AND "tDramas"."STATUS" = "tSTATUS"."Status-ID" AND "tDrama-Genre"."Drama-ID" = "tDramas"."ID" AND "tDrama-Genre"."Genre-ID" = "tGenre"."ID" AND "tDramas"."SCORE" > 8.75 AND "tSTATUS"."Status" = 'completed' AND "tDrama-Genre"."Genre-ID" = 21
When I looked at the SQL for that query, I thought “I wonder what would happen if I simply type OR 22 at the end of that SQL?” What happened is that LO completely hung and I had to open Task Manager and End Task.
Since I have the information I was after, the workaround worked, more or less. But I am curious to know why the “21 or 22” didn’t work, and why the syntax of the query with the “OR” is so different from those without.