Probably a very basic solution to this, but I can’t seem to figure it out. I’m trying to match
multiple ID’s in one table towards another.
Structure is something like this,
tt_staff (ID - name)
2 - Lenny
3 - Carl
tt_run (producer1 - producer2)
2 (i.e Lenny)
3 (i.e Carl)
I want to create a view with a single row that shows me the names of both Carl and Lenny, rather then their ID’s.
Tried the following,
SELECT e.*, run.*, s.s_name FROM tt_run AS run, tt_events AS e, tt_staff AS s
WHERE e.e_ID = run.e_ID
AND run.e_bandproducer1 = s.s_ID
AND run.e_bandproducer2 = s.s_ID
This obviously doesn’t work, since the ID is found on producer1. I’ve also tried with UNION, but not familiar enough with it (I did manage to get the right result, but in two rows).
As always, thanks for any replies.
It looks like you just need to join tt_staff twice: