0
SELECT admin.User, a.time

FROM admin 

LEFT JOIN a ON admin.User=a.User

LEFT JOIN b ON admin.User=a.User

So I have three tables, admin then a & b. At the moment I get tables a & b by joining via a shared field called User. However tables a & b have a field called 'types' which is not in the admin table.

What I want to do is instead of select 'types' twice - once for table a and once for table b, is have the 'types' field combined so there is only one results set for that field.

1 Answer 1

1

try to use ifnull(a.types, b.types) as types to export the field. (MySQL)

so that it try to get a.types first, if that yields null, then yields b.types instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.