Home  |  Linux  | Mysql  | PHP  | XML
From:Ron Piggott Date:Sat Feb  6 15:33:47 2010
Subject:Cross reference query help

The following is a query I am working on today. I need help tweaking on it.

What I am trying to get for results from the query are where there are
rows in either table, not all 3 tables linked together.

In other words I am trying to INNER JOIN these two pairs of tables for
possible results:

`store_product_profile` and `paypal_cart_info`

OR

`store_product_profile` and `mail_order_cart`

SELECT `store_product_profile`.`product_name`
FROM (
`store_product_profile`
INNER JOIN `paypal_cart_info` ON `store_product_profile`.`reference` =
`paypal_cart_info`.`itemnumber`
)
INNER JOIN `mail_order_cart` ON `store_product_profile`.`reference` =
`mail_order_cart`.`store_product_profile_reference`
WHERE `store_product_profile`.`discontinued` =0
AND `store_product_profile`.`reference` =7

Finally I need help with the GROUP BY syntax also. I only want the name
of the product once, not if it was in several previous purchases.

Any help is appreciated.

Ron

Navigate in group php.db at sever news.php.net
Previous Next


Your recent visits
Re: [PHP-DB] Run php script on windows
currval of an index in Postgres to pass on?
Re: Rounding up results
Re: [PHP-DB] FW: semaphores WAS: [PHP-DB] Automatic logoff
PHP Help with pagination



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants