Hi,
If you dont really need the count of picture and you just need to know
if a picture exist or not for the product,
the subquery is useless, you could use :
SELECT product.productid,
product.title,
product.added,
picture.w AS `width`,
picture.h AS `height`,
picture.m AS `mime`,
picture.id #or: IF(picture.id IS NULL, 'NO_PICTURE',
'PICTURE')
FROM `product`
LEFT JOIN `picture`
ON product.productid = picture.productid
AND picture.pic != ''
WHERE categoryid = '$categoryid'
AND `categoryid` IN $catlist
AND `display` = '1'
ORDER BY `title` ASC
LIMIT $start,$products
Antoine
www.doubleclique.com
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---