如何在sql中的select查询中使用更新查询

时间:2017-09-12 11:21:17

标签: php mysql

在此选择查询中,我获取了我想要显示的各个字段名称的所有字段值。现在,问题是我如何使用更新查询来更新这些字段名称的字段值,如'personnum'或'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

0 个答案:

没有答案