从drupal导出数据到excel

时间:2014-08-26 09:49:04

标签: excel drupal export

我需要将我的所有用户的webform提交数据导出到excel文件。我可以导出用户,但是如何使用相关的webforms我现在不这样做。求你帮帮我。

1 个答案:

答案 0 :(得分:0)

这个怎么样:

select CONCAT(GROUP_CONCAT(CONCAT('"', sd.data, '"' )), ', "',u.uid, '","', u.name, '", "', u.mail,'"') from webform_submitted_data sd JOIN webform_submissions s ON s.sid = sd.sid JOIN users u ON u.uid = s.uid GROUP by s.sid LIMIT 1 INTO OUTFILE '/Users/nandersen/Downloads/users.csv' FIELDS TERMINATED BY '' ENCLOSED BY '' LINES TERMINATED BY '\n';

您需要对网络表单数据进行分组,这些数据是多行但只有一列,用户数据位于多列但只有一行。因此,通过单独连接数据并按提交ID进行分组,您可以获得所需的数据。

将输出如下内容:

"Nate","Andersen","nate@test.com","123 Atlanta Avenue","Nederland","Texas","12345","4095496504","safe_key4","safe_key6","safe_key2","09/07/1989", "69","oknate", "nate@test.com"