Skip to content
Advertisement

Showing conditional Where Condition in SQL SERVER

I am trying to achieve something like this.

I wanted to show state and city column in the where clause only when backguid is empty i.e. 00000000-0000-0000-0000-000000000000. Else I want to show only one column i.e. buildingID=backguid

Overall code that I used here is :

However, I am not able to achieve it via Case. I dont know what I am missing.

Advertisement

Answer

This may help

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement