This is a discussion on Alias with a Join within the MySQL forums, part of the Database Server Software category; --> Here's the basic statement: SELECT * FROM `log` LEFT JOIN (`ticket`, `responder`) ON `log`.`ticket_id` = `ticket`.`id` AND `log`.`responder_id` = ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Here's the basic statement: SELECT * FROM `log` LEFT JOIN (`ticket`, `responder`) ON `log`.`ticket_id` = `ticket`.`id` AND `log`.`responder_id` = `responder`.`id`; That works. Now I'd like to alias a number of fields in the 'joined' tables, ticket and responder. How do I express an alias of, say, ticket.name or responder.status? Thanks, all. -AS |
| |||
| == Quote from ashore (shoreas@gmail.com)'s article > Here's the basic statement: > SELECT * FROM `log` LEFT JOIN (`ticket`, `responder`) ON > `log`.`ticket_id` = `ticket`.`id` AND `log`.`responder_id` = > `responder`.`id`; > That works. > Now I'd like to alias a number of fields in the 'joined' tables, > ticket and responder. How do I express an alias of, say, ticket.name > or responder.status? > Thanks, all. > -AS the alias would be on the table. your statement would look like this: select * from log a left join (ticket b, responder c) on a.ticket_id = b.id and a.responder_id = c.id you see how it is cleaner and shorter. -- POST BY: lark with PHP News Reader ;o) |