harlock
11-20-2005, 06:28 AM
I have four values.
I have a select query where I want to ask the database to give me rows only where ALL four of these values don't match up, but if any subset is matching to still let it through.
So if value1, value2, and value3 all match their counterparts in the database entry but value4 is different, it will still return that row as a search result.
If all four values are identical, it will not return that row.
I'm running into a snag where if I just use "and value1 != $value1 and value2 != $value2 and value3 != $value3 and value4 != $value4" then of course it will not return any entry with any ONE Of those values matching. If I put that section in parenthesis, it does not help.
So I'm looking for some syntax where if ALL those parameters match, the row isn't returned in the search results. But if any three or less happen to match up, include the row in the search results. So some kind of encapsulation for that part of the query. Does it need to be a sub-query? Haven't messed with nested queries too much yet...
I have a select query where I want to ask the database to give me rows only where ALL four of these values don't match up, but if any subset is matching to still let it through.
So if value1, value2, and value3 all match their counterparts in the database entry but value4 is different, it will still return that row as a search result.
If all four values are identical, it will not return that row.
I'm running into a snag where if I just use "and value1 != $value1 and value2 != $value2 and value3 != $value3 and value4 != $value4" then of course it will not return any entry with any ONE Of those values matching. If I put that section in parenthesis, it does not help.
So I'm looking for some syntax where if ALL those parameters match, the row isn't returned in the search results. But if any three or less happen to match up, include the row in the search results. So some kind of encapsulation for that part of the query. Does it need to be a sub-query? Haven't messed with nested queries too much yet...