Re: [PHP] need help to build a query
- From: ceo@xxxxxxxxx ("Richard Lynch")
- Date: Tue, 10 Oct 2006 14:22:54 -0500 (CDT)
On Mon, October 9, 2006 2:58 pm, John Wells wrote:
On 10/9/06, afan@xxxxxxxx <afan@xxxxxxxx> wrote:
but I know there must be much better solution then this one.
You're right: Simply JOIN your queries...
SELECT order_id, order_date, order_status, file_name
FROM orders
JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
ORDER BY orders.order_id DESC
LIMIT 100
This will "miss" all the orders with no upload at all, unlike the
original.
AND it limits you to the 100 uploaded files, not 100 orders.
This is a lot more subtle problem than it seems at first glance, eh?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.
- Follow-Ups:
- Re: [PHP] need help to build a query
- From: "Ivo F.A.C. Fokkema"
- Re: [PHP] need help to build a query
- From: "John Wells"
- Re: [PHP] need help to build a query
- From: afan
- Re: [PHP] need help to build a query
- References:
- need help to build a query
- From: afan
- Re: [PHP] need help to build a query
- From: "John Wells"
- need help to build a query
- Prev by Date: Re: [PHP] need help to build a query
- Next by Date: Re: [PHP] need help to build a query
- Previous by thread: Re: [PHP] need help to build a query
- Next by thread: Re: [PHP] need help to build a query
- Index(es):