2 cx15151495250 cx15151495250 于 2014.09.23 15:52 提问

这个语句应该怎么修改?

SELECT BDM_UserID, CRM_CustomerRegisterDate,MIN(DATE_FORMAT(BDM_ListenStartTime,"%Y_%m_%d")),MIN(DATE_FORMAT(BDM_ListenEndTime,"%Y_%m_%d")),SUM(BDM_ListenTimeLength)
FROM ETCRM.CRM_CustomerInfo o INNER JOIN ETBDM.BDM_UserInfo p ON o.BDM_UserName=p.BDM_UserName
INNER JOIN ETBDM.BDM_UserListenRec q ON p.BDM_UIID =q.BDM_UserID
WHERE (CRM_CustomerRegisterDate >='2013-01-01' AND CRM_CustomerRegisterDate<'2014-01-01') AND (BDM_ListenStartTime>='2013-01-01' AND BDM_ListenStartTime<'2014-01-01')
AND BDM_UserID !='' AND BDM_UserID='9741708'
GROUP BY BDM_UserID,MIN(DATE_FORMAT(BDM_ListenStartTime,"%Y_%m_%d"))

结果显示“Invalid use of group function”,不知道问题出在哪

1个回答

beijixinga58
beijixinga58   2014.09.23 20:03

DATE_FORMAT(NOW(),'%m-%d-%Y')
是"-"不是"_"

Csdn user default icon
上传中...
上传图片
插入图片