lostintheloop
lostintheloop

Reputation: 43

Checking columns for blanks

I have 2 columns: colA and colB. I want a query that would retrieve values from colA, but if there is a blank in the column, I want to retrieve it from colB and vice versa. I should note that colA must have precedent over colB in the case that there are 2 values in both columns. I know in SQL server you can use the isNull function but I can't seem to find the equivalent for MS Access.

Upvotes: 1

Views: 43

Answers (1)

Sachu
Sachu

Reputation: 7766

select Nz(ColA, ColB) from table1

Or you can use IIF(IsNull(ColA),ColB,ColA)

Upvotes: 2

Related Questions