There was coding 48 hours in a row, and I knock my head on the wall here. Please help me with this little problem.
My SQL query is this:
SELECT u.Firstname, u.Lastname, u.Rep, u.Email, u.Password, u.Gender, u.Level, u.Birthday, u.Achievements, u.Height, u.Unit, u.cityid, u.countryid, r.RegDate, ci.Name AS City, co.Name AS Country FROM Users u, Registry r, Cities ci, Countries co WHERE u.id = 1 AND r.uid = u.id AND u.cityid = ci.id AND u.countryid = co.id LIMIT 1
My problem is that I just noticed that sometimes Users.cityid and Users.countryid are NULL (this is normal).
I want the request to provide me with all the information (e.g. return NULL for City and Country ) for this user, even if one or both of these fields is NULL . How to make AND parts conditional?
I hope I clarify my nebula.
source share