How to... simple sql statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • flintridgeparkenfarker vonkerschnauzerheiden

    #1

    How to... simple sql statement

    I'd like to replace a field value but don't know the proper syntax. The
    record currently has a NULL in the datetime field and I'd like to enter a
    real value from the command line. (I'm just getting started with MySQL)

    Thanks for any input...

    --
    joe
    /*------- A new survey of online daters found that
    47% of people believe that their online date will
    go well... the other 53% are still missing. -------*/


  • Aggro

    #2
    Re: How to... simple sql statement

    flintridgeparke nfarker vonkerschnauzer heiden wrote:[color=blue]
    > I'd like to replace a field value but don't know the proper syntax. The
    > record currently has a NULL in the datetime field and I'd like to enter a
    > real value from the command line. (I'm just getting started with MySQL)[/color]

    You should almost always have id-field in your table. If that is the
    case, find out what is the id for row you want to change, then

    update yourtablename set yourdatetimefie ldname='2005-01-01' where id=5;

    Where '2005-01-01' can be the date you want and 5 the id of the row you
    want to change.

    If you have multiple null values and you want to convert all those to
    have a certain date, you can also say:

    update yourtablename set yourdatetimefie ldname='2005-01-01' where
    yourdatetimefie ldname is null;

    Comment

    • flintridgeparkenfarker vonkerschnauzerheiden

      #3
      Re: How to... simple sql statement

      Thank you very much. Yes, there is an ID number.

      I can see this ng is going to be a great resource.

      I appreciate it.


      "Aggro" <spammerdream@y ahoo.com> wrote in message
      news:0Nkhe.104$ sa3.73@read3.in et.fi...[color=blue]
      > flintridgeparke nfarker vonkerschnauzer heiden wrote:[color=green]
      > > I'd like to replace a field value but don't know the proper syntax. The
      > > record currently has a NULL in the datetime field and I'd like to enter[/color][/color]
      a[color=blue][color=green]
      > > real value from the command line. (I'm just getting started with MySQL)[/color]
      >
      > You should almost always have id-field in your table. If that is the
      > case, find out what is the id for row you want to change, then
      >
      > update yourtablename set yourdatetimefie ldname='2005-01-01' where id=5;
      >
      > Where '2005-01-01' can be the date you want and 5 the id of the row you
      > want to change.
      >
      > If you have multiple null values and you want to convert all those to
      > have a certain date, you can also say:
      >
      > update yourtablename set yourdatetimefie ldname='2005-01-01' where
      > yourdatetimefie ldname is null;[/color]


      Comment

      Working...