It's a little more complicated... I'll outline the table structure to show you what we're working with. I've stripped it down to the columns we need to see and colour coded the relationships between columns / tables for clarity.
TABLE 1 - Mail
Columns: id, sender_type, sender_id
TABLE 2 - Sender Types
TABLE 3 - Contains full names
Can be any one of 3 database tables depending on sender type. Each contains the following consistent columns amongst others unique to that table.
Columns: id, first_name, last_name
I need to be able to order the list of mails fetched from table 1 by the combined first_name and last_name value of table 3... I'm out of my depth and would greatly appreciate a solution (code if possible) from someone that knows how to achieve this.