Lampwrights Forum > Linux, Apache, MySQL, PHP > MySQL

Reply
 
Thread Tools
02-23-2011, 11:10 AM   #1
Jeff
Administrator
 
Jeff's Avatar
 
Join Date: Jul 2010
Posts: 402
Rep Power: 10
Jeff is getting browny points
Toggling a MySQL TinyInt Column

This query:

Code:
UPDATE table set field= 1 - field
Will toggle a tinyint (boolean) column in MySQL. Note, that field should have a default value of either 0 or 1 but not NULL.
Jeff is offline   Reply With Quote

01-28-2024, 04:38 AM   #2
Gavinplato
Junior Member
 
Join Date: Jan 2024
Posts: 1
Rep Power: 0
Gavinplato is getting browny points
Have you encountered any specific challenges or considerations when toggling MySQL TinyInt columns using this query, especially regarding the default value of the 'field' column?
Gavinplato is offline   Reply With Quote
Reply

Tags

mysql queries

,

other mysql


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 03:38 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2024, vBulletin Solutions, Inc.