[eluser]Buso[/eluser]
[quote author="Ingonyama" date="1258093801"]If I have 2 tables events and categories and they both have columns with the same names:
events table columns:
id, title, description, category_id
categories table columns:
id, title, description, order_num
SELECT * FROM events JOIN categories ON events.category_id = categories.id
Will produce:
id, title, description, category_id, id, title, description, order_num
Is it standard practice to prefix with the table name when using this kind of join so we can tell which column we are dealing with? Or is there something I'm missing here?[/quote]
SELECT * FROM events AS a
JOIN categories AS b ON
a.category_id = b.id
For tables with more fields its nice to have these alias