cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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

AviralBhardwaj

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 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group