SQL-Update-Statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Freitag

    #1

    SQL-Update-Statement

    Hello!
    I have a litte problem with my sql-database!
    I have to update all UA-fields in the table idrz_kennzahl with primary
    key idrz, where the same idrz in the table per_verwaltung with the
    field Amt=12 is.

    I designed following statement but it doesn't work:

    update idrz_kennzahl
    set UA=1234
    where
    idrz_kennzahl.i drz =
    (SELECT per_verwaltung. idrz from per_verwaltung where
    per_verwaltung. Amt=12)


    Does anybody has an idea for my prob - sorry i'm an mysql-newbie!

    Thanks,
    Christian
  • Richard Wilson

    #2
    Re: SQL-Update-Statement

    chfreitag@web.d e (Christian Freitag) wrote:
    [color=blue]
    > Hello! I have a litte problem with my sql-database! I have to update all
    > UA-fields in the table idrz_kennzahl with primary key idrz, where the same
    > idrz in the table per_verwaltung with the field Amt=12 is.
    >
    > I designed following statement but it doesn't work:
    >
    > update idrz_kennzahl set UA=1234 where idrz_kennzahl.i drz = (SELECT
    > per_verwaltung. idrz from per_verwaltung where per_verwaltung. Amt=12)[/color]

    In good tradition, I've not time to test it, but try using:

    UPDATE idrz_kennzahl, perverwalting SET idrz_kennzahl.U A=1234 WHERE
    idrz_kennzahl.i drz=per_verwalt ung.idrz AND per_verwaltung. Amt=12;

    [color=blue]
    > Does anybody has an idea for my prob - sorry i'm an mysql-newbie![/color]

    MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
    documentation somewhere in the UPDATE bit.

    R.
    --
    Richard Wilson, Publications Manager
    Tradelink Publications Ltd.

    Comment

    • Richard Wilson

      #3
      Re: SQL-Update-Statement

      chfreitag@web.d e (Christian Freitag) wrote:
      [color=blue]
      > Hello! I have a litte problem with my sql-database! I have to update all
      > UA-fields in the table idrz_kennzahl with primary key idrz, where the same
      > idrz in the table per_verwaltung with the field Amt=12 is.
      >
      > I designed following statement but it doesn't work:
      >
      > update idrz_kennzahl set UA=1234 where idrz_kennzahl.i drz = (SELECT
      > per_verwaltung. idrz from per_verwaltung where per_verwaltung. Amt=12)[/color]

      In good tradition, I've not time to test it, but try using:

      UPDATE idrz_kennzahl, perverwalting SET idrz_kennzahl.U A=1234 WHERE
      idrz_kennzahl.i drz=per_verwalt ung.idrz AND per_verwaltung. Amt=12;

      [color=blue]
      > Does anybody has an idea for my prob - sorry i'm an mysql-newbie![/color]

      MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
      documentation somewhere in the UPDATE bit.

      R.
      --
      Richard Wilson, Publications Manager
      Tradelink Publications Ltd.

      Comment

      • Richard Wilson

        #4
        Re: SQL-Update-Statement

        chfreitag@web.d e (Christian Freitag) wrote:
        [color=blue]
        > Hello! I have a litte problem with my sql-database! I have to update all
        > UA-fields in the table idrz_kennzahl with primary key idrz, where the same
        > idrz in the table per_verwaltung with the field Amt=12 is.
        >
        > I designed following statement but it doesn't work:
        >
        > update idrz_kennzahl set UA=1234 where idrz_kennzahl.i drz = (SELECT
        > per_verwaltung. idrz from per_verwaltung where per_verwaltung. Amt=12)[/color]

        In good tradition, I've not time to test it, but try using:

        UPDATE idrz_kennzahl, perverwalting SET idrz_kennzahl.U A=1234 WHERE
        idrz_kennzahl.i drz=per_verwalt ung.idrz AND per_verwaltung. Amt=12;

        [color=blue]
        > Does anybody has an idea for my prob - sorry i'm an mysql-newbie![/color]

        MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
        documentation somewhere in the UPDATE bit.

        R.
        --
        Richard Wilson, Publications Manager
        Tradelink Publications Ltd.

        Comment

        • Aggro

          #5
          Re: SQL-Update-Statement

          Richard Wilson wrote:
          [color=blue]
          > MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
          > documentation somewhere in the UPDATE bit.[/color]

          MySQL supports sub selects, starting from version 4.1

          http://www.mysql.com/doc/en/ANSI_diff_Subqueries.html

          Comment

          • Aggro

            #6
            Re: SQL-Update-Statement

            Richard Wilson wrote:
            [color=blue]
            > MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
            > documentation somewhere in the UPDATE bit.[/color]

            MySQL supports sub selects, starting from version 4.1

            http://www.mysql.com/doc/en/ANSI_diff_Subqueries.html

            Comment

            • Aggro

              #7
              Re: SQL-Update-Statement

              Richard Wilson wrote:
              [color=blue]
              > MySQL doesn't support sub-SELECTs. It's detailed in the accompanying
              > documentation somewhere in the UPDATE bit.[/color]

              MySQL supports sub selects, starting from version 4.1

              http://www.mysql.com/doc/en/ANSI_diff_Subqueries.html

              Comment

              Working...