Try replacing the comma with JOIN

igor
decide.com

On Mon, May 28, 2012 at 6:48 AM, shan s <mysub...@gmail.com> wrote:

> I need help with a simple subquery. Given below data, I need counts and
> percentage counts per category. (Re-phrasing my earlier question )
> With the code below I get an error: *FAILED: Parse Error:* line 6:50 
> *mismatched
> input ','* *expecting EOF near 'a'*
>
> Looking at the documentation the syntax it is not clear to me.. In the
> form clause, can I have multiple selects and just alias them and use them
> in the top query?
> If so, what am I missing in the below code...
>
> select a.category, a.count, b.totalCount
> from
> (select category, count(*) as count from gt group by category) a,
> (select count(*) as totalCount from gt) b ;
>
> Many Thanks,
> Prashant.
>
> Id Category         Count Output   Percentage Output
> 1    A                    A      4             A     40 (4/10)*100
> 2    A                    B      3             B     30
> 3    B                    C      3             C     30
> 4    A
> 5    C
> 6    C
> 7    B
> 8    B
> 9    A
> 10  C
>

Reply via email to