The sql looks simply doing the below. Not sure why it is this complicated.

    select  CATE1, count (distinct CATE2)  from kylinlabel.USER_TAG group
by CATE1

The issue with original SQL is it does not have a select clause at the
highest level. If hide out sub-queries, what is left is

    t5 left join t4

Where is the SELECT?


On Wed, Dec 21, 2016 at 1:30 PM, wang...@snqu.com <wang...@snqu.com> wrote:

> excute sql:
> (select cate1 from kylinlabel.USER_TAG group by cate1) as t5
> left join
> (select t3.CATE1,count(*) from (select  CATE1 ,CATE2 from
> kylinlabel.USER_TAG  group by CATE1 ,CATE2) as t3 group by t3.CATE1) as t4
> on (t4.cate1=t5.cate1)
>
> get error:
> Encountered "as" at line 1, column 56. Was expecting one of: <EOF> "ORDER"
> ... "LIMIT" ... "OFFSET" ... "FETCH" ... "UNION" ... "INTERSECT" ...
> "EXCEPT" ... "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "="
> ... ">" ... "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/"
> ... "||" ... "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ...
> "MULTISET" ... "[" ... "OVERLAPS" ... "YEAR" ... "MONTH" ... "DAY" ...
> "HOUR" ... "MINUTE" ... "SECOND" ...
>
>
> wang...@snqu.com
>
> From: Billy Liu
> Date: 2016-12-21 12:19
> To: dev
> Subject: Re: kylin 1.6 supports SQL right join
> Kylin supports left join and inner join. The right join could be rewritten
> into left join. Could you have a try?
>
> 2016-12-21 11:52 GMT+08:00 wang...@snqu.com <wang...@snqu.com>:
>
> > Hi
> >     when I excute the sql:
> > (select  t3.CATE1,count(*) from (select  CATE1 ,CATE2 from
> > kylinlabel.USER_TAG  group by CATE1 ,CATE2) as t3 group by t3.CATE1) as
> t4
> > right join
> > (select cate1 from kylinlabel.USER_TAG group by cate1) as t5 on
> > (t4.cate1=t5.cate1)
> >
> > I got the error:
> > Encountered "as" at line 1, column 129. Was expecting one of: <EOF>
> > "ORDER" ... "LIMIT" ... "OFFSET" ... "FETCH" ... "UNION" ... "INTERSECT"
> > ... "EXCEPT" ... "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR"
> ...
> > "=" ... ">" ... "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*"
> ...
> > "/" ... "||" ... "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET"
> ...
> > "MULTISET" ... "[" ... "OVERLAPS" ... "YEAR" ... "MONTH" ... "DAY" ...
> > "HOUR" ... "MINUTE" ... "SECOND" ...
> >
> > I think the sql is right but cann't get the result, what can I do?
> >
> >
> >
> >
>

Reply via email to