I want to have a conditional where clause that operates as so:
Where Column1 = 'value1'
Where column1 = 'value1' and column2 = 'value2'
Can anyone help with this?
You could just do the following:
SELECT *FROM TableWHERE (@booleanResult = 1 AND Column1 = 'value1')OR (@booleanResult = 0 AND Column1 = 'value1' AND Column2 = 'value2')
Hope this helps!
Want to know more about SQL ? Join this SQL training course and certification by Intellipaat.