how can I change category status from 1 to 0 and from 0 to 1 in a single query ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joel123456
    New Member
    • Feb 2010
    • 1

    how can I change category status from 1 to 0 and from 0 to 1 in a single query ?

    Hi all.

    using MySQL how can I change 'category_statu s' from 1 to 0 and from 0 to 1 in a single query ?

    like update `product_catego ries` WHERE `categories_sta tus` = 1 - `categories_sta tus`

    This doesn't work, please help

    Thank you guys
  • jupi13
    New Member
    • Jul 2008
    • 18

    #2
    update product_categor ies set categories_stat us = 0 where categories_stat us = 1....
    u try..
    if it doesn't work..u should have a unique attribute where u could have the where clause..

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hey.

      Check out the IF() function. You can use that in the SET clause to toggle values like that.

      Comment

      Working...