this is mikel.org

Michael Boyle's weblog

  • home
  • archives
  • about
  • words

Lazyweb:

September 2, 2004 by Michael Boyle

Lazyweb:

Does anyone know how, in MySQL, one might instruct it to search for all posts before a certain date, check if a variable = 2 or 1, and if so, make it = 0? I had MT-CloseComments on for a while, then MT-B came out which is much better but in the old pre-MT weblog I didn’t have comments anyhow, so there’s no point in even having the line there saying Comments (0). Which will disappear if I set the variable to 0 in MT, but which I decidedly do NOT want to do one-by-one.

Tags: Blogging

Comments

  1. Michael says

    September 2, 2004 at 12:20 pm

    OH – one more detail – I want to do this once and then not worry about it again (MT-B will take care of things).

  2. BB says

    September 2, 2004 at 10:50 pm

    Isn’t is something like this:

    update tablename

    set field_to_update = 0

    where field_to_update > 0

    and date_field

  3. Michael says

    September 3, 2004 at 11:18 am

    Thanks B – I’ll take a look.

  4. Alan says

    September 3, 2004 at 5:14 pm

    I’d make that

    [UPDATE table_name

    SET field_to_update = 0

    WHERE (field_to_update = 1

    OR field_to_update = 2)

    AND date_field

    You might also find this useful

    http://www.birdbrained.org/blog/archives/000046.php

  5. Alan says

    September 3, 2004 at 5:15 pm

    (btw. your comment preview is stripping HTML tags, while your posting allows them (: )

  6. Michael says

    September 3, 2004 at 6:23 pm

    Thanks! Prompted by your post I in fact when to Jason Levine’s Q Daily News and used a script he recently put together, but in a bit of a different way than he did. I just set the date to 351 days and changed the action the script took (changed the value to 0 for older posts, which were pre-MT for me) and saved it in my root and it worked like a charm in about a second.

    Since I only had to do this once, I just trashed the script after.

  7. Michael says

    September 3, 2004 at 6:24 pm

    BTW Thanks for noting the problem with my comments. My whole comments section is screwed at the moment, though the bare bones works OK.

search

recent

  • Diouf Article
  • Anil Dash: We’re not being alarmist enough about climate change…
  • Learning about Gutenberg
  • From the “I thought I’d heard it all” file
  • One year since his passing: The Day Prince’s Guitar Wept the Loudest

Archives

Copyfight US Politics Business Canada Montreal Friend Music Email Media Canadian Politics NYTimes Browser Sports International Affairs Software Web Design Microsoft Personal Social Networks Test War Design Web Wired GNE Funny Search Apple Blogging Arts Google Internet
Michael Boyle Blog
  • Email
  • Facebook
  • Twitter

Copyright © 2000–2025 · Michael Boyle

Copyright © 2025 · Modern Portfolio Pro Theme on Genesis Framework · WordPress · Log in