Привет, у меня есть ниже запрос MySQL, кто-нибудь может мне помочь, как я могу выполнить это для запроса куста с тем же выводом?
МОЙ ЗАПРОС:
SELECT YEAR(transdate) AS _year,DATE(transdate) AS sodate,custid,
UPPER(TRIM(REPLACE(sendername,''Ñ'',''N''))) AS sender,
CONCAT(UCASE(MID(sendergender,1,1)),MID(LOWER(sendergender),2)) as sendergender,YEAR(NOW())-YEAR(senderbirthdate) AS age,
a.zonecode,b.regioncode,b.areacode,a.branchcode,c.zonename,
UPPER(TRIM(REPLACE(b.regionname,''Ñ'',''N''))) AS regionname,
UPPER(TRIM(REPLACE(b.areaname,''Ñ'',''N''))) AS areaname,
UPPER(TRIM(REPLACE(b.branchname,''Ñ'',''N''))) AS branchname FROM test.test1 a
INNER JOIN test.branches b ON b.branchcode=a.branchcode AND b.zonecode=a.zonecode
INNER JOIN test.zonecodes c ON c.zonecode=a.zonecode
WHERE YEAR(transdate)= 2017 GROUP BY if(custid is null or custid='''',sender,custid),regionname;