This may be difficult to explain so please bear with me. I am running a query that is meant to test whether two records are related in some way, there are three different types of relationships they have and I only need to see if one exists. This is accomplished using a few left joins and a subquery and the end result is three rows that are either 0 or 1. The SELECT looks like this:
The method that calls this has to do a check on each one e.g if count1 > 0 || count2 > 0 etc. I was just wondering if there was a way to get the total directly in MySQL, I know SUM won't work in this case and can't seem to find anything appropriate. Seems kind of silly to go through this just to avoid a few or's in my conditional but it just seems sloppy to me.
Does anyone heave any suggestions?
This post has been edited by Jstall: 16 March 2011 - 07:59 AM