我有以下查询结果
SELECT DISTINCT user_id,
IF(ra.status = 1, created_datetime, 'No record') AS ACTIVATED,
IF(ra.status = 0, created_datetime, 'No record') AS DE_ACTIVATED
FROM accounts ra
WHERE user_id IN ( 12345678 );
+----------+---------------------+---------------------+
| user_id | ACTIVATED | DE_ACTIVATED |
+----------+---------------------+---------------------+
| 12345678 | No record | 2013-04-28 02:32:36 |
| 12345678 | 2013-03-28 02:32:36 | No record |
+----------+---------------------+---------------------+
我试图只有 1 行记录,结合激活和停用。基本上,让它像这样。
+----------+---------------------+---------------------+
| user_id | ACTIVATED | DE_ACTIVATED |
+----------+---------------------+---------------------+
| 12345678 | 2013-03-28 02:32:36 | 2013-04-28 02:32:36 |
+----------+---------------------+---------------------+
非常感谢任何帮助,因为我建立了我的查询忍者技能。
问候