[thelist] MySQL Table fields

Howard Cheng howcheng at ix.netcom.com
Thu Jan 23 13:45:00 CST 2003

If you go back to the sample SQL query I gave you:

SELECT     i.ItemID, i.CategoryID [whatever your field names are],
FROM       Items i
INNER JOIN Categories c
         ON i.CategoryID = c.CategoryID
WHERE      i.ItemID = '$II'

you should notice that I gave both tables aliases: i for Items and c for
Categories. Then I prefixed each field name with the alias. In fact, if you
have multiple columns with the same name, you have to do this (or as Rudy
pointed out, just prefix with the table name), or the SQL engine isn't
going to be able to figure out which columns you want.

At 03:40 PM 1/23/2003 +0000, Andrew Maynes wrote:
>$result=mysql_query("$DBName","SELECT ItemSKU, ItemName, ItemDescription,
>ItemCost, Category, ShippingCost, ItemID FROM Items INNER JOIN category ON
>Category = Category WHERE ItemID='$II'");
>too many category 's?

Howard Cheng
howcheng at ix dot netcom dot com
AIM: bennyphoebe
ICQ: 47319315

More information about the thelist mailing list