Thursday, November 23, 2006

Update records in MySQL

You can tell I'm doing lots of work at the moment due to all the blog posts (as wrong as that sounds!). Anyway, a note to myself here. I often want to update a load of records in MySQL, i.e. setting a field from "Yes" to "No" etc. For some reason everytime I try to remember the single line query I forget! Anyway here it is:

UPDATE glinks_Category SET Category_Template='' WHERE Category_Template='navcategory.html'

Obviously you will need to replace the table and field names but that's the structure. Always back up before doing anything. Use at your own risk.