hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wd ...@wdicc.com>
Subject Re: subquery in select
Date Mon, 28 May 2012 09:39:28 GMT
I didn't have run it. I think the sql I write should work in every db....

On Mon, May 28, 2012 at 4:54 PM, shan s <mysub987@gmail.com> wrote:
> That was a typo in the email, but it still errors after the typo is
> corrected.
> Did you try to run it?
>
> Here is the entire script after creating the file, gt.txt from data
> below....
>
> CREATE EXTERNAL TABLE IF NOT EXISTS gt (id INT,  category STRING)
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE
> LOCATION '/user/user1/ht/gt';
> LOAD DATA LOCAL INPATH 'gt.txt' OVERWRITE INTO TABLE gt;
> CREATE TABLE IF NOT EXISTS Res (category STRING, count INT, perVal INT)
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE;
> INSERT OVERWRITE TABLE  Res
> select a.category, a.count, b.totalCount
> from
> (select category, count(*) as count from gt group by category) a,
>

Maybe you should delete this white line?

> (select count(*) as totalCount from gt) b ;
>
> On Mon, May 28, 2012 at 1:55 PM, wd <wd@wdicc.com> wrote:
>>
>> group by category
>>
>> On Mon, May 28, 2012 at 2:20 PM, shan s <mysub987@gmail.com> wrote:
>> > (select category, count(*) as count from gt group by cat) a,
>
>

Mime
View raw message