MySQL Forums
Forum List  »  Newbie

Re: Comparing multiple field values
Posted by: Ben Alger
Date: April 09, 2014 05:12PM

Thanks much, Jerry. Apparently I must be doing something terribly wrong :(

That's likely due to me omitting key info from my post. Sorry. I've learned a bit more about the table.

The below is what I wrote, based on your kind guidance/instruction. I've commented each line to help clarify whay I did and why.

SELECT DISTINCT t1.`company`
FROM `tab_Rates` t1 JOIN `tab_Rates` t2 ON t1.`company` = t2.`company`
AND t1.`rateType` != t2.`rateType` //unchanged
WHERE t1.`rateType` IN ('type1','type2') //turns out there were more than the 2 possibilities I listed in my 1st post
AND t1.`payMethod` LIKE 'card' //this was key and I totally missed it.
AND t1.`company` IN ('ABCD','ABCE','ABCF','ABCG','ABCH') //not all companies have payMethod card
AND t1.`activated` LIKE 'Y' /not all rates in the table are active
AND t1.`amount1` != t2.`amount1` //unchanged

Results: I get results, and quickly, but they are false positives.

Thanks again, and sorry for the pig's ear.

Options: ReplyQuote


Subject
Written By
Posted
Re: Comparing multiple field values
April 09, 2014 05:12PM


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.