cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Subquery does not work in Databricks Community version?

THIAM_HUATTAN
Valued Contributor

I am testing some SQL code based on the book SQL Cookbook Second Edition, available from https://downloads.yugabyte.com/marketing-assets/O-Reilly-SQL-Cookbook-2nd-Edition-Final.pdf

Based on Page 43, I am OK with the left join, as shown here:

imageHowever, when I try with subquery below, it fails, why?

image

2 REPLIES 2

Aviral-Bhardwaj
Esteemed Contributor III

it must have some github link check there or you cans hare your code and data we can help you

those 3 CSV files are uploaded here:

https://github.com/tanthiamhuat/SQLCookbook

below SQL code works when I work with SQL Server, but does not work in Databricks SQL.

select e.ename, d.loc,

(select eb.received from emp_bonus eb

where eb.empno=e.empno) as received

from emp e, dept d

where e.deptno=d.deptno

order by 2 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.