MySQL Forums
Forum List  »  Newbie

Help with query with conditions
Posted by: Aaron Nicolais
Date: February 03, 2010 08:49AM

I am trying to run the following query. In this query it shows all contacts with an email address but does not show the ones without an email address. This is because of the second to last line "AND = email_addr_bean_rel.bean_id". What I need is to run all the lines except this one. Then also run all the lines with this one and put the 2 pieces of data together so I have the contacts with and without email addresses. Is there a way to do this with some sort of case/if statement or what would be the best way to go about this? I am doing this right from a command line.


accounts_cstm.result_status_date_c,accounts_cstm.Listsource_c, accounts_cstm.product_interest_c,,contacts.first_name,contacts.last_name, contacts.title,contacts.phone_work, email_addresses.email_address, contacts.primary_address_street,contacts.primary_address_city, contacts.primary_address_state, contacts.primary_address_postalcode,primary_address_country,notes.description
FROM notes, accounts, accounts_cstm, contacts, accounts_contacts,email_addr_bean_rel, email_addresses
WHERE = accounts_cstm.id_c
AND accounts_contacts.contact_id =
AND accounts_contacts.account_id =
AND notes.contact_id =
AND accounts_cstm.result_status_c LIKE 'Qualified Lead%'
AND = email_addr_bean_rel.bean_id
GROUP BY contacts.last_name

Options: ReplyQuote

Written By
Help with query with conditions
February 03, 2010 08:49AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.