Tyler
Tyler

Reputation: 23

SQL Using Where on Isnull column

I have

Select
isnull(s1.column, s.column) Supplier
from table
where 

I am not sure what to put in the where to filter by supplier name when using the isnull.

Upvotes: 2

Views: 39

Answers (1)

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726499

Since there is no actual Supplier column, put your filtering condition on the isnull(s1.column, s.column) expression:

SELECT
ISNULL(s1.column, s.column) Supplier
FROM MyTable
WHERE ISNULL(s1.column, s.column) = 'DesiredValue'

Upvotes: 2

Related Questions