I am joining my address book onto my email table like this:
SELECT * FROM messages m
LEFT JOIN addr_book a ON
m.to_msg LIKE a.h_email
OR m.to_msg LIKE a.bill_email
OR m.to_msg LIKE a.b_email
OR m.to_msg LIKE a.w_email
OR m.to_msg LIKE a.other_email
OR m.from_msg LIKE a.h_email
OR m.from_msg LIKE a.bill_email
OR m.from_msg LIKE a.b_email
OR m.from_msg LIKE a.w_email
OR m.from_msg LIKE a.other_email
OR m.cc_msg LIKE a.h_email
OR m.cc_msg LIKE a.bill_email
OR m.cc_msg LIKE a.b_email
OR m.cc_msg LIKE a.w_email
OR m.cc_msg LIKE a.other_email
OR m.bcc_msg LIKE a.h_email
OR m.bcc_msg LIKE a.bill_email
OR m.bcc_msg LIKE a.b_email
OR m.bcc_msg LIKE a.w_email
OR m.bcc_msg LIKE a.other_email
The problem is it fetches everything, because some contacts don’t have emails and join up with emails that don’t have cc_msg=” or bcc_msg=”
Is there a way I can left join a table on a column where the column is like ‘@’??
I tried a couple things like IN (m.to_message LIKE a.h_email WHERE a.h_email LIKE '%@%') OR etc etc
But I keep getting errors.
Any ideas?
Thanks a ton!
Ok so that helps out alot. I don’t know why, but I have always assumed = is case sensitive in mySQL. I used the following and it works beautifully. Thanks all, I’m sure if I had proper training I wouldn’t have made this mistake in the first place lol.