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