- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Error while compiling statement: FAILED: SemanticException [Error 10002]: Line 1:54 Invalid column reference 'TotalRecords'
- Labels:
-
Apache Hive
Created ‎06-17-2016 05:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why can I not use TotalRecords field from sub query in the outer query?
It throws: Error while compiling statement:
FAILED: SemanticException [Error 10002]: Line 1:54 Invalid column reference 'TotalRecords'
This is what my query looks like:
SELECT temp.delay, count(*) as filteredRecords , temp.TotalRecords FROM ( select sales_flat_order.created_at as delay, count(*) over() as TotalRecords FROM magentodb.sales_flat_order LEFT OUTER JOIN erpdb.dispatch ON sales_flat_order.increment_id == dispatch.order_num where TO_DATE(created_at) >= DATE_SUB(current_date(),10) ) As temp WHERE temp.delay > 1 GROUP BY temp.delay Order BY temp.delay
Created ‎06-17-2016 06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems like TotalRecords is a keyword. Try using TotalRecords_1 and see if it helps.
Thanks and Regards,
Sindhu
Created ‎06-17-2016 07:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did. That wasn't the issue. I needed to take Total column in the group by clause of outer query. Thanks
Created ‎06-20-2016 06:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please share the steps that resolved the issue and mark as best answer?
Thanks,
Sindhu
