vishalarya
asked on
Left Join SQL Access change blank field
When using an update query in Access, I'm doing a left join on two tables, so that those rows that match will be updated with fields from the 2nd table, while if the rows in the 1st table don't match, then the field will be blank. However, I want this field, if blank, to default to something else, for example "N/A". I outline a simple example:
Table 1: Table2:
---------
row1 row2 row1 row2
1 1 a
2 2 b
3
If I LEFT JOIN Table 1 and Table 2 on row1, and set table1.row2 = table2.row2, I will get:
Table1:
row1 row2
1 a
2 b
3 ""
I would like the 3rd position to not be blank, but some other text. How can I do this?
Thanks,
Vishalarya
Table 1: Table2:
---------
row1 row2 row1 row2
1 1 a
2 2 b
3
If I LEFT JOIN Table 1 and Table 2 on row1, and set table1.row2 = table2.row2, I will get:
Table1:
row1 row2
1 a
2 b
3 ""
I would like the 3rd position to not be blank, but some other text. How can I do this?
Thanks,
Vishalarya
select row1, iif(isnull(row2), 'N/A', row2)
Use the IIF conditional
IIF(your_field = "", "N/A", your_field)
IIF(your_field = "", "N/A", your_field)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, you're welcome.