| David Mitchell 2007-10-22, 4:00 am |
| Good man. That' probably what he really wanted to do.
On 10/21/07, Neil Smith [MVP, Digital media] <php@comatose.freeserve.co.uk>
wrote:
>
> At 19:31 19/10/2007, you wrote:
>
>
>
> That's *completely* wrong SQL for what you're trying to do. Reading
> between the lines (you didn't say what you *really* want to do), you
> seem to want one order_item row and the details about its order for
> each order item. Your query needs to be :
>
> SELECT orders.*, order_items.*
> FROM orders LEFT JOIN order_items
> ON orders.order_id = order_items.order_id
>
>
> UNION is completely the wrong thing here - it can only compare
> identical things, you're trying to join together two different data
> columns (order, and order_items details)
>
> HTH
> Cheers - Neil
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
|