On Sat, 03 Oct 2009 10:39:48 Rob Jensen wrote:
> Hi Michael,
>
> If you're just trying to establish if you have a picture or not try this:
>
> ###
> SELECT
>     product.productid,product.title,product.added,picture.w AS `width`,
> picture.h AS `height`,picture.m AS `mime`,
>     IF( ISNULL( picture.pic ) || picture.pic = '' , 0 , 1 ) AS `pcx`
> FROM
>     `product`
>     LEFT JOIN `picture` ON product.productid=picture.productid
> WHERE
>     categoryid='$categoryid'
>     AND `categoryid` IN $catlist
>     AND `display`='1'
> ORDER BY
>     `title` ASC
> LIMIT $start,$products
> ###
>
> That should save you a sub query and establish if you have pictures or not.

Thanks -

Though in this query where does it do the equivalent of WHERE 
productid='$productid' on the table 'picture'.

Remember this query is pulling info from 2 tables-
'product' - productid, title
'picture' - width, height, mime (fields w, h, m)
and pic (the blob field) only need to know if exists.

--~--~---------~--~----~------------~-------~--~----~
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