Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Trigger value > ? write in different table

Trigger value > ? write in different table

Scheduled Pinned Locked Moved Database
databasemysqlpythoncomlinux
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brian1210
    wrote on last edited by
    #1

    https://stackoverflow.com/questions/...rts-new-data-t

    I tried the link above but receiving a syntax error, my is easier then that one.
    I have datetime, temperature, and humidity written in a table called tempdata.
    I would like to have trigger that if value is above 65 for temperature (float), write to a different table or database called test.
    Then email out when test is modified.

    I've been trying phpmyadmin because I'm not good with command line.

    I have phpmyadmin 4.5.4
    mysql ver 14.14 distrib 5.7.20
    python 2.7.12
    Ubuntu mate 1.16.2
    Gnome 2
    Raspberry pi 2

    Thank You

    CREATE TRIGGER TemperatureHigh
    AFTER INSERT
    ON RawTemperature FOR EACH ROW
    BEGIN
    IF (new.temperature > 65
    THEN
    INSERT INTO `test`;

      END IF;
    

    END

    V L Richard DeemingR 3 Replies Last reply
    0
    • B brian1210

      https://stackoverflow.com/questions/...rts-new-data-t

      I tried the link above but receiving a syntax error, my is easier then that one.
      I have datetime, temperature, and humidity written in a table called tempdata.
      I would like to have trigger that if value is above 65 for temperature (float), write to a different table or database called test.
      Then email out when test is modified.

      I've been trying phpmyadmin because I'm not good with command line.

      I have phpmyadmin 4.5.4
      mysql ver 14.14 distrib 5.7.20
      python 2.7.12
      Ubuntu mate 1.16.2
      Gnome 2
      Raspberry pi 2

      Thank You

      CREATE TRIGGER TemperatureHigh
      AFTER INSERT
      ON RawTemperature FOR EACH ROW
      BEGIN
      IF (new.temperature > 65
      THEN
      INSERT INTO `test`;

        END IF;
      

      END

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      brian1210 wrote:

      receiving a syntax error

      In what line is the error detected? Isn't it the problem with "open" bracket without the "close" one here:

      IF (new.temperature > 65

      1 Reply Last reply
      0
      • B brian1210

        https://stackoverflow.com/questions/...rts-new-data-t

        I tried the link above but receiving a syntax error, my is easier then that one.
        I have datetime, temperature, and humidity written in a table called tempdata.
        I would like to have trigger that if value is above 65 for temperature (float), write to a different table or database called test.
        Then email out when test is modified.

        I've been trying phpmyadmin because I'm not good with command line.

        I have phpmyadmin 4.5.4
        mysql ver 14.14 distrib 5.7.20
        python 2.7.12
        Ubuntu mate 1.16.2
        Gnome 2
        Raspberry pi 2

        Thank You

        CREATE TRIGGER TemperatureHigh
        AFTER INSERT
        ON RawTemperature FOR EACH ROW
        BEGIN
        IF (new.temperature > 65
        THEN
        INSERT INTO `test`;

          END IF;
        

        END

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Your INSERT statement does not look complete.

        1 Reply Last reply
        0
        • B brian1210

          https://stackoverflow.com/questions/...rts-new-data-t

          I tried the link above but receiving a syntax error, my is easier then that one.
          I have datetime, temperature, and humidity written in a table called tempdata.
          I would like to have trigger that if value is above 65 for temperature (float), write to a different table or database called test.
          Then email out when test is modified.

          I've been trying phpmyadmin because I'm not good with command line.

          I have phpmyadmin 4.5.4
          mysql ver 14.14 distrib 5.7.20
          python 2.7.12
          Ubuntu mate 1.16.2
          Gnome 2
          Raspberry pi 2

          Thank You

          CREATE TRIGGER TemperatureHigh
          AFTER INSERT
          ON RawTemperature FOR EACH ROW
          BEGIN
          IF (new.temperature > 65
          THEN
          INSERT INTO `test`;

            END IF;
          

          END

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          You have already posted this in QA: Trigger value > ? write in different table[^] Your question was incomplete there too.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups