Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 12:02 PM
Hi @Harsha777 ,
What occurs is called column shadowing.
What happens is that the column names in main query and sub query are identica and the databricks engine after not finding it in sub query searches in the main query.
The simplest way to avoid the issue is to add to the column the table alias like below:
SELECT count(*) FROM `catalog`.`schema`.`t_table` AS main
WHERE main._col_check IN (
SELECT DISTINCT sub._col_check FROM `catalog`.`schema`.`t_check_table` AS sub
)