logoalt Hacker News

nathanfries • today at 7:11 AM • 1 reply • view on HN

Why can't consecutive OR statements with common columns be reduced to IN? (I say consecutive since I assume ordering matters).

WHERE id = 1 OR id = 2... Should be abled to be reduced to WHERE id IN (1,2...)

However WHERE id = 1 OR name = 'John' OR id = 2 Maybe can't be reduced to WHERE id IN (1,2) OR name = 'John'


Replies

moring • today at 7:24 AM

Why does order of the OR operands matter?

➕ show 2 replies