I have the following query:

SELECT item.productid, `quantity` , (

SELECT `price`
FROM `prices`
WHERE `productid` = item.productid
AND `the_company` = '1'
AND `the_forex` = 'NZD'
AND `the_level` = '1'
) AS `price` , (

SELECT `title`
FROM `product`
WHERE `productid` = item.productid
) AS `title`
FROM `item`
JOIN `product` ON product.productid = item.productid
LEFT JOIN `prices` ON prices.productid = item.productid
WHERE `uid` = 'deleted'
ORDER BY `productid`
LIMIT 0 , 30

which I am testing.

This request should return the list of items in the user's cart (table 'item') 
along with the price (table 'prices') and the product title/description 
(table 'product')

The problem is that it is returning 115 results when it should be returning 7, 
as there is 7 different items in the user's cart. It appears to be returning 
one line PER CURRENCY (16 currencies used) and ignoring the where 
specification for NZD. I have checked and confirmed that the 'prices' table 
does not have duplicate rows.

I am totally lost.

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to