General information
Title:
How to use nulls from outer join in SQL Union
I receive the error "Field CBYADDRESS does not accept null values" when I run the SQL command below. This first SQL Select does not return NULLs, but the second one does. Making the second SQL first solves the problem. Unfortunately, I have other queries where the first SQL Select, and/or second one can return NULLs.
I will eventually make these SQL Selects into views. Is there some setting in a view or FoxPro to resolve this error?
Thanks!
SELECT ;
MainCase.DAddress AS cByAddress, ;
MainCase.DCity AS cByCity, ;
MainCase.DState AS cByState, ;
MainCase.DTaxID AS cByTaxID, ;
MainCase.DZip AS cByZip ;
FROM MainCase ;
WHERE MainCase.Office + MainCase.CaseNo = ?gcOfficeCaseNumber ;
UNION ALL ;
SELECT ;
Joint.JDAddr, ;
Joint.JDCity, ;
Joint.JDState, ;
Joint.JDTaxID, ;
Joint.JDZip ;
FROM ;
MainCase LEFT JOIN Joint ;
ON Joint.Office + Joint.CaseNo = MainCase.Office + MainCase.CaseNo ;
WHERE MainCase.Office + MainCase.CaseNo = ?gcOfficeCaseNumber
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only