Format Yes/No fields after Union

D

DD

I have 2 tables which have a field whose value is either Yes or No.
After performing a UNION query on both these tables the corresponding
resuting field shows a value of -1 for Yes and 0 for No.
I'm not being able to format that to Yes or No.
I need to export these results to a text file.

Kindly help.
Thanks.
DS.
 
M

Marshall Barton

DD said:
I have 2 tables which have a field whose value is either Yes or No.
After performing a UNION query on both these tables the corresponding
resuting field shows a value of -1 for Yes and 0 for No.
I'm not being able to format that to Yes or No.
I need to export these results to a text file.

A Yes/No field is stored as -1/0, the "Yes" and "No" are
just presentation formatting.

Try using the format function in the field:

SELECT somefield, Format(YNfield, ";\Y\e\s;\N\o")
FROM tableA
UNION
SELECT somefield, Format(YNfield, ";\Y\e\s;\N\o")
FROM tableB
 
Top