Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Using "AS" for subquery in SAP HANA SQL

Hi,

I'd want to use "AS" to create a temp table for the result of a subquery. But the query can not be executed.How can I fix this error?

Do I need to create a view ?

select

  c_count, count(*) as custdist

from (

  select

  c_custkey,

  count(o_orderkey)

  from

  customer left outer join orders on

  c_custkey = o_custkey

  and o_comment not like '%special%requests%'

  group by

  c_custkey

  )as c_orders (c_custkey,c_count)

group by

  c_count

order by

  custdist desc,

  c_count desc;



Many thanks in advance!

Naomy



Message was edited by: Tom Flanagan

Tags:
Former Member
Former Member replied

Hi Naomy,

Please remove "(c_custkey,c_count)" after c_orders.

Best regards,

Wenjun

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question