Uploaded image for project: 'Tajo (Retired)'
  1. Tajo (Retired)
  2. TAJO-1791

Cannot recognize column name from FROM subquery

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      This is TPC-H q13 in TPC-H Reference document.

      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;
      

      TAJO cannot run this query because of this line.

      as c_orders(c_custkey, c_count)
      

      To run this query, modify a little bit like below.

      select
      	c_count, count(*) as custdist
      from (
      	select
      		c_custkey, count(o_orderkey) c_count
      	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
      group by c_count
      order by custdist desc, c_count desc;
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dkhwangbo Dongkyu Hwangbo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: