ranjith23 Posted March 22, 2018 Report Posted March 22, 2018 Input SQL: Select * from data a where a.id = ‘1944’ And (case when a.country = ‘USA’ then ‘1=1’ Else ‘Exists(Select * from skip_id b where a.id = b.id)’ end); Expected Output SQL: USA: Select * from data a where a.id = ‘1944’ And 1 = 1; Non USA: Select * from data a where a.id = ‘1944’ And Exists(Select * from skip_id b where a.id = b.id); Notes: needed to be fixed by modifying case logic only. No other option Quote
RamGopalVarma Posted March 23, 2018 Report Posted March 23, 2018 Select * from data a where a.id = '1944' And (( a.country = 'USA' AND 1=1 ) OR (a.id =(Select b.id from skip_id b where a.id = b.id) )) Quote
iPhoneX Posted March 23, 2018 Report Posted March 23, 2018 1 hour ago, RamGopalVarma said: Select * from data a where a.id = '1944' And (( a.country = 'USA' AND 1=1 ) OR (a.id =(Select b.id from skip_id b where a.id = b.id) )) velli @Herpes treatment teesko mundu Quote
Staysafebro Posted March 23, 2018 Report Posted March 23, 2018 1 hour ago, WigsandThighs said: Delete all bro Never delete all.. drop random tables Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.