Louie,
The inner-join is just joining the two tables, shopcart and items.
I think iip is an alias for items, but the alias would normally come after the name of the tiems table. Another way to write the query is (assuming iip is an alias for items),
SELECT * FROM shopcart, items iip WHERE shopcart.itemID = iip.itemID AND shopcart.cookieId = '4bfa673ee4c544d4352e2c70a78b70b5' order by iip.itemName asc
The inner-join is just an alternative to what's above.
I read on some site that there were two advantages:
1) Kept the the WHERE-clause a bit simpler
2) Was a bit faster, as the tables were pre-matched; I doubt this, and the source wasn't particularily trustworth. The MySQL manual doesn't mention any performance gains from using the INNER-JOIN functionality
Here's the relevant MySQL manual page: http://dev.mysql.com/doc/mysql/en/JOIN.html
The relevant section:
"INNER JOIN and , (comma) are semantically equivalent in the absence of a join condition: both will produce a Cartesian product between the specified tables (that is, each and every row in the first table will be joined onto all rows in the second table)."
By comma, they mean the comma seperating the two tables in the FROM clause, as I've written it above (FROM shopcart, items).
David
Louie Miranda wrote:
Hi,
Im just a new comer on mysql and i was in the middle of debugging some codes that aint mine. I was stuck here. I could not figure what does this select do?
Its complicated..
Can anyone help me out?
select * from shopcart inner join items on shopcart.itemId = iip.itemId where shopcart.cookieId = '4bfa673ee4c544d4352e2c70a78b70b5' order by iip.itemName asc
Thanks
-- - Louie Miranda http://www.axishift.com
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]