Link to home
Start Free TrialLog in
Avatar of vishalarya
vishalaryaFlag for United States of America

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
Avatar of derekkromm
derekkromm
Flag of United States of America image

select row1, iif(isnull(row2), 'N/A', row2)
Use the IIF conditional

IIF(your_field = "", "N/A", your_field)
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, you're welcome.