TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Newbie SQL Query problem? (http://www.talkphp.com/absolute-beginners/5903-newbie-sql-query-problem.html)

RallanToo 07-01-2011 03:01 PM

Newbie SQL Query problem?
 
Hi

I'm new at this, so bear with me :-)

I'm trying the following query in PHP with MySQL:

$sqlFull = "SELECT feed_items.id AS feedID, store_products.id AS storeID";
$sqlFull .= " FROM store_products";
$sqlFull .= " FULL JOIN feed_items";
$sqlFull .= " ON master_item_id=feed_items.id";

If I run it like that then I get an error:
Unknown column 'store_products.id' in 'field list'

If I change "store_products.id" to just "id" it says:
Column 'id' in field list is ambiguous

Help?

core1024 07-05-2011 12:59 PM

PHP Code:

$sqlFull .= " FROM store_products";
$sqlFull .= " FULL JOIN feed_items"

Here if you see the word "FULL" means nothing but alias of store_products so either remove this word or change "store_products.id" to "FULL.id"


All times are GMT. The time now is 12:23 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0