I am looking to dynamically select specific columns within a join query in which a specific field will only be selected if the value of another is not equal to 0.
So here's what I have going on.
The query uses the following 3 tables, users - schools - campuses
I would like to select all of the data from users, and if the campus_id field of users is not equal to 0, then I would like to include the campus name field of campuses where campuses.id = users.campus_id, how would I do this?
CREATE TABLEstatements), sample data (asINSERTstatements), as much of the query as you have, results of the query and desired results.