Having a problem with a WHERE search statement would like to use a construction like..
WHERE f.foo IN
CASE @bar
WHEN 'BAR' THEN
('FOO','BAR',BAZ')
WHEN 'BAZ' THEN
('FOOBAR','FOOBAZ')
END
or
WHERE CASE @bar
WHEN 'BAR' THEN
f.foo IN ('FOO','BAR',BAZ')
WHEN 'BAZ' THEN
f.foo IN ('FOOBAR','FOOBAZ')
END
where @bar is a well defined temp variable of the correct type and all that f is defined nicely..
I get an error about "Error at ','
WHERE (@bar = 'BAR' and f.foo IN ('FOO', 'BAR', 'BAZ')) OR
(@bar = 'BAZ' and f.foo IN ('FOOBAR', 'FOOBAZ'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With