would
assume that if a record exists in CONTACT_X_CUSTOMER then there would be
corresponding records in both of those tables.
I know this has been a huge post but you
Oops, that LEFT JOIN ADDRESS ON IF(etc...) shouldn't be in the big long select
statement
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
D, IF(CUSTOMER.ID_ADDRESS_SHIPTO > 0,
CUSTOMER.ID_ADDRESS_SHIPTO = ADDRESS.ID, CUSTOMER.ID_ADDRESS_MAIN = ADDRESS.ID)
This actually worked great, I only had to refer to ADDRESS once in the select for
output, I only had to join the other tables CITY, PROVINCE, COUNTRY once on ADDRESS
too.
BUT
06/02/2004 11:31 cc: "MYSQL-List (E-mail)" <[EMAIL
PROTECTED]>
AM Fax to:
Subjec
Luc,
This looks like you want a list of all Customers with Contacts (because you
are basing it on the CONTACT_X_CUSTOMER table) and you want to show the
Address (if it exists) or the Shipping Address (if it exists) instead of
the Address? Am I close?
If I want to get one of two or more result ch
Ok, I got a result here, still trying to determine if its correct or not :)
LEFT JOIN ADDRESS ON IF(CONTACT_X_CUSTOMER.ID_ADDRESS > 0,
CONTACT_X_CUSTOMER.ID_ADDRESS = ADDRESS.ID, IF(CUSTOMER.ID_ADDRESS_SHIPTO > 0,
CUSTOMER.ID_ADDRESS_SHIPTO = ADDRESS.ID, CUSTOMER.ID_ADDRESS_MAIN = ADDRESS.ID))