Re: Help with a query
| From: | Joel Colombo | Date: | Wed, 05 Mar 2003 07:08:38 +0000 |
| Subject: | Re: Help with a query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26101@lists.php.net to get a copy of this message | ||
i am not testing this... just writing it here. and it is 2am !
SELECT shopping_cart.item_id, shopping_cart.subtotal, shopping_cart.quantity
FROM shopping_cart, orders WHERE shopping_cart.order_id = orders.order_id
AND orders.session_id = session_id() AND orders.customer_id = '$customer_id'
i guess u could give it a try.
just a simple 2 table join.
i may not have the fields and order in place but try it....
Joel Colombo
"Jonathan Villa" <jvilla@isdesigndev.com> wrote in message
news:000001c2f79c$11a52670$8e00a8c0@inhocvince...
>
> I can't figure this query out.
>
> I want to pull data from 2 tables but using a primary key from one.
>
> Here is what I think it should look like.
>
> SELECT item_id, subtotal, quantity from shopping_cart WHERE order_id =
> (SELECT order_id FROM orders WHERE session_id = session_id()) AND
> customer_id = $customer_id;
>
> -Jonathan
>
>
>