Mysql sets a flag for each match
I have the following request:
SELECT users_extra.first_name, users_extra.last_name
FROM (branches, users_extra)
WHERE ((branches.manager_id = users_extra.userid)
OR (branches.sales_manager_id = users_extra.userid)
OR (branches.admin_manager_id = users_extra.userid)
OR (branches.ops_manager_id = users_extra.userid)
OR (branches.export_manager_id = users_extra.userid)
OR (branches.import_manager_id = users_extra.userid))
AND branches.branch_id = [$VAR]
How do I return the column name or some kind of flag for each match so that I can return the position of each manager, like this:
first_name, last_name, position
joe soap manager
john doe ops manager
+2
source to share