Alex K
Alex K

Reputation: 7217

select from column where value in a list or no such column

Ok here's my task

I have a list of lenders like this

lender  name
1       lender 1
2       some other lender

and I have a list of states like this

lender  state
1       AK
1       WY
1       NY
2       AZ
2       FL 

so i have an area, for example FL, i need to select all lenders where state = "FL" OR where state is not defined at all (this would mean ANY state)

I can't figure out how to do the second part (where state is not defined). Any help to figure out?

Thanks

Upvotes: 0

Views: 335

Answers (2)

UltraInstinct
UltraInstinct

Reputation: 44444

select * from lenders where state='FL' or state is null

Upvotes: 1

dee-see
dee-see

Reputation: 24078

Assuming the "undefined" fields are NULL, you could simply add OR state IS NULL to your query.

Upvotes: 0

Related Questions