Re: need help to build a query

From: Date: Mon, 09 Oct 2006 21:50:56 +0000
Subject: Re: need help to build a query
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-242875@lists.php.net to get a copy of this message
Yes you are right, but I guess you can decide which is worse: sending extra data in one query or send extra queries. I guess it depends on how many records we're talking about... Brad also brings up a good point I hadn't considered. I do think an OUTER join is possible, perhaps depending on your mysql version... Which brings up something I had meant to say before, which is that this isn't actually a PHP question... :) John W On 10/9/06, afan@afan.net <afan@afan.net> wrote:
But, in this case I will have repeating order_date and order_status info?
id    order_date    status    file_name
12    2006-10-09    live      file1.jpg
12    2006-10-09    live      file2.jpg
12    2006-10-09    live      file3.jpg
13    2006-10-09    live      file1.jpg
14    2006-10-09    live      test.gif
right? On 10/9/06, afan@afan.net <afan@afan.net> 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
HTH, John W
thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#242875) next »