|Re: IN, sub-select and select distinct
> I can't believe there is no way to achieve the "explicit IN"I generally like using EXISTS, but I don't think it can beat the
> performance with a JOIN, a sub-select or anything else.
alternatives already mentioned. And trying to look up values anywhere
can never beat hardcoding values, it is like trying to access the
harddisk quicker than the RAM.
If this is a query that is executed often and speed is essential, then
I'd say your only really quick alternative would be to make another
table and populate it through AFTER INSERT/UPDATE/DELETE triggers from
your main table. Then you could simply do
SELECT <whatever> FROM <NewTriggerPopulatedTable>
whenever you needed these values.