1

In this select query i am getting all the field values of respective field names which i want to show. Now, the problem is how can i use the update query to update the field value of those field name like 'personnum' or 'clearingnum'.

    SELECT *
    FROM (

    SELECT DATE_FORMAT( FROM_UNIXTIME( submit_time ) , '%b %e, %Y  %l:%i %p' ) AS Submitted, 
MAX( IF( `field_name` = 'your-email', field_value, NULL ) ) AS 'your-email', 
MAX( IF( `field_name` = 'your-id', field_value, NULL ) ) AS 'your-id', 
MAX( IF( `field_name` = 'personnum', field_value, NULL ) ) AS 'personnum', 
MAX( IF( `field_name` = 'clearingnum', field_value, NULL ) ) AS 'clearingnum', 
MAX( IF( `field_name` = 'kontonum', field_value, NULL ) ) AS 'kontonum'
    FROM wp_cf7dbplugin_submits
    WHERE `form_name` = 'Uppgifter form'
    GROUP BY submit_time
    ORDER BY submit_time DESC
    ) AS wpcf7_fetched_data
    WHERE `your-id` = 4
neer
  • 4,031
  • 6
  • 20
  • 34
Roy.N
  • 79
  • 1
  • 1
  • 7
  • 1
    You can't update a derived table in MySQL the way you would do so with a CTE in some other databases. Please show the update query you have in mind. – Tim Biegeleisen Sep 12 '17 at 11:24
  • Check [this (UPDATE FROM)](https://stackoverflow.com/questions/1262786/mysql-update-query-based-on-select-query) – neer Sep 12 '17 at 11:25
  • Actually i am also seeking for the update query. – Roy.N Sep 12 '17 at 11:27
  • hiw you want join this select with table to update ?? which columns are involved for join the result (select table) and the to update table? – ScaisEdge Sep 12 '17 at 11:28
  • i want to update the field_value of column 'personnum' , 'clearingnum' and 'kontonum' .. These three are my column names . i want to write a update query which will update the results dynamically from a field – Roy.N Sep 12 '17 at 12:55

0 Answers0