Re: subquery syntax error

2012-06-05 Thread Igor Tatarinov
The columns you ORDER BY must be SELECTed. If you don't want identifier2 in
the output, you will need to wrap your query with another SELECT.

Hope this helps.
igor
decide.com

On Tue, Jun 5, 2012 at 10:53 PM, Avdeev V. M.  wrote:

> Hello!
>
> I can't understand what's wrong.
>
>drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select cast(2 as int) identifier2, short_descr area_name from t0) asdf
> select *--area_name
> order by identifier2 desc, area_name asc
> ;
>
> The query works fine but if I remove * then
>
> drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select cast(2 as int) identifier2, short_descr area_name from t0) asdf
> select area_name
> order by identifier2 desc, area_name asc
> ;
>
> fails with error "FAILED: Error in semantic analysis: Line 6:9 Invalid
> table alias or column reference identifier2"
> The query
>
> drop table if exists t0;
> create table t0 (short_descr string) STORED AS SEQUENCEFILE;
> from (
> select short_descr area_name from t0) asdf
> select area_name
> order by area_name asc
> ;
>
> works fine too. What's wrong with 'no mapped' columns?
>
> Thanks!
>


subquery syntax error

2012-06-05 Thread Avdeev V . M .
Hello!

I can't understand what's wrong.

 

drop table if exists t0;
create table t0 (short_descr string) STORED AS SEQUENCEFILE;
from (
 select cast(2 as int) identifier2, short_descr area_name from t0) asdf
select *--area_name
order by identifier2 desc, area_name asc
;

The query works fine but if I remove * then

drop table if exists t0;
create table t0 (short_descr string) STORED AS SEQUENCEFILE;
from (
 select cast(2 as int) identifier2, short_descr area_name from t0) asdf
select area_name
order by identifier2 desc, area_name asc
;

fails with error "FAILED: Error in semantic analysis: Line 6:9 Invalid table 
alias or column reference identifier2"
The query

drop table if exists t0;
create table t0 (short_descr string) STORED AS SEQUENCEFILE;
from (
 select short_descr area_name from t0) asdf
select area_name
order by area_name asc
;

works fine too. What's wrong with 'no mapped' columns?

Thanks!