Welcome Guest, Not a member yet? Register   Sign In
db query problem
#4

[eluser]aquary[/eluser]
Not sure if you could do that within a normal single query....

Maybe a subquery might work ? I assume from the example that both row 1 and row 3 will be updated.

Code:
UPDATE the_table SET status=0 WHERE id IN (
   SELECT TB1.id FROM the_table TB1
     JOIN the_table TB2
        ON(TB1.member_id=TB2.selected_id)
           OR (TB1.selected_id=TB2.member_id)
   );


Try runnning the subquery part to see if the ids are those to be updated.


Messages In This Thread
db query problem - by El Forum - 02-24-2012, 06:03 AM
db query problem - by El Forum - 02-24-2012, 08:53 AM
db query problem - by El Forum - 02-24-2012, 09:49 PM
db query problem - by El Forum - 02-24-2012, 11:59 PM
db query problem - by El Forum - 02-25-2012, 11:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB