如何在Hive查询中执行此MySQL查询

时间:2019-03-08 03:24:05

标签: mysql hiveql

嗨,我在一个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;

0 个答案:

没有答案