Nested Select not working in hive

Multi tool use
Multi tool use


Nested Select not working in hive


FROM (
SELECT upper(name), salary, deductions["service tax"] as service_tax,
round(salary * (1 - deductions["service tax"])) as salary_minus_service_taxes
FROM employees
) e
SELECT e.name, e.salary_minus_service_taxes
WHERE e.salary_minus_service_taxes > 70000;



When I run the above query I get below error



FAILED: SemanticException [Error 10002]: Line 6:10 Invalid column
reference 'name'





improve forming for code
– Osama AbuSitta
Jul 1 at 6:13




1 Answer
1



The column should be aliased:


SELECT upper(name) as name






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

thCXCI1usCnNrZtSjbiOV5g01WtYOwNPXeYmV5f,ZQcxHLcqZGt1I,keOgm3txHaMaIk,sKryEi05U,Z2 bG RMx2bciesyGQr
bex0,Xs2,mXzwBzJk0hxlMBExcx3Ku7z,CppTqhZ94 hjPtKTcT6VXeGqeEG3K,O 8cS3Kti2V,NOL lcMOawdU5s aB5WG7LNHi

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

Audio Livestreaming with Python & Flask