ccrevcypsys Posted September 17, 2007 Share Posted September 17, 2007 hello every one i get this error. MySQL Error Occured n1052: Column 'customer_id' in where clause is ambiguous n QUERY = SELECT * FROM cc_CubeCart_bio LEFT JOIN cc_CubeCart_inventory o cc_CubeCart_inventory.custome _id=cc_CubeCart_inventory.custome _id LEFT JOIN cc_CubeCart_customer on cc_CubeCart_customer.customer_id=cc_CubeCart_bio.customer_id WHERE customer_id !=31 AND cat_id=24 AND deleted = 0 ORDER BY popularity DESC My goal for this part of my site is to list the band members by order of popularity and by catigory. So all of the artist with the same catagory will show their names excluding the profile that you are currently looking at. how do i fix that? here is the pull code $_GET['customer_id'] = treatGet($_GET['customer_id']); $_GET['cat_id'] = treatGet($_GET['cat_id']); $otherbands = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_bio LEFT JOIN ".$glob['dbprefix']."CubeCart_inventory on ".$glob['dbprefix']."CubeCart_inventory.customer_id=".$glob['dbprefix']."CubeCart_inventory.customer_id LEFT JOIN ".$glob['dbprefix']."CubeCart_customer on ".$glob['dbprefix']."CubeCart_customer.customer_id=".$glob['dbprefix']."CubeCart_bio.customer_id WHERE customer_id !=".$_GET['customer_id']." AND cat_id=".$_GET['cat_id']." AND deleted = 0 ORDER BY popularity DESC"); Quote Link to comment https://forums.phpfreaks.com/topic/69650-solved-mysql-pull-help-plz/ Share on other sites More sharing options...
BlueSkyIS Posted September 17, 2007 Share Posted September 17, 2007 you need to alias your tables so MySQL knows which customer_id you are talking about in "WHERE customer_id !=31 AND cat_id=24 AND deleted = 0 ORDER BY popularity DESC" Something like this: SELECT A.* FROM cc_CubeCart_bio A LEFT JOIN cc_CubeCart_inventory B on A.customer_id=B.customer_id LEFT JOIN cc_CubeCart_customer C on C.customer_id=A.customer_id WHERE A.customer_id !=31 AND A.cat_id=24 AND A.deleted = 0 ORDER BY popularity DESC Quote Link to comment https://forums.phpfreaks.com/topic/69650-solved-mysql-pull-help-plz/#findComment-349954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.