>Are there any advantages to converting this 'working' query below to
>use INNER JOIN ?
>If so, what would the correct syntax be ?
>
>SELECT category.name, page.name, content.title, content.body
>FROM category, page, content
>WHERE content.page_id = page.id
>AND page.category_id = category.id
>AND category.id =1
>ORDER BY content.order_id ASC
>LIMIT 0 , 30

Explicit INNER JOINs are easier to read, easier to debug, and since 5.0.12 always preferable in MySQL for reasons given at http://dev.mysql.com/doc/refman/5.1/en/join.html (look for '5.0.12').

SELECT category.name, page.name, content.title, content.body
FROM category
INNER JOIN content USING (category_id)
INNER JOIN page USING (page_id)
WHERE category.id = 1
ORDER BY content.order_id ASC
LIMIT 0 , 30

PB



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.1/347 - Release Date: 5/24/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to