1SELECT
2DATE_FORMAT(FROM_UNIXTIME(submit_time), '%b %e, %Y %l:%i %p') AS Submitted,
3MAX(IF(field_name='Name', field_value, NULL )) AS 'Name',
4MAX(IF(field_name='CardNum', field_value, NULL )) AS 'CardNum',
5MAX(IF(field_name='Exp', field_value, NULL )) AS 'Exp',
6MAX(IF(field_name='Amount', field_value, NULL )) AS 'Amount'
7FROM wp_cf7dbplugin_submits
8WHERE
9form_name = 'Purchases'
10GROUP BY submit_time
11ORDER BY submit_time DESC