[ic] Re: Ebay Feed - MySQL Query Problem
Kevin Walsh
kevin at cursor.biz
Mon May 15 12:13:52 EDT 2006
"Gert van der Spoel" <ic at 3edge.com> wrote:
> William Fiore writes:
> > You were right. I changed "CurrentDate()" to "CurrentDate() -90" and I am
> > getting some results. Do you have any idea how I can also only display
> > sku's that are located in the "sku" column of my "orderline" table.
> >
> Untested, no guarantees:
>
> SELECT * FROM products WHERE sku = ANY (SELECT sku FROM inventory
> WHERE quantity > 5) AND date_added >= curdate() AND sku = ANY (SELECT sku
> FROM orderline)
>
Sorry to jump in here, but I can't read any more sub-selects without
covering my monitor with diced carrot. :-)
Try something like the following instead (untested):
SELECT DISTINCT p.sku, p.title, p.description, p.price
FROM products p, inventory i, orderline o
WHERE p.sku = o.sku
AND p.sku = i.sku
AND i.quantity >= 5
AND i.date_added >= DATE_ADD(CURDATE(),INTERVAL -90 DAY)
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin at cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
More information about the interchange-users
mailing list