I have the following sql statement:
SELECT Useraccount.Name, Company.Name FROM Useraccount, Company WHERE Useraccount.CompanyId = Company.ID This statement shows all useraccount-names and the name of their company.
But I also have useraccounts where the companyId is 0 and I'd like to get them displayed too (Name of the company could be an empty string in this case). How can I do that?
0. I don't like them but that's whatNULLis for. You can add an explicit foreign key constraint if you convert the 0s to Nulls.