You can translate the question and the replies:

Subqueries in the WHERE Clause of the Query unable to find the table

Hello, I have added multiple tables in the view and joined all those tables. In the WHERE CONDITIONS, I have written something similar to this: A IN (select A from TABLEA where TABLEA.A=TABLEB.A ). It has been validated successfully, but when I want to save it, it pops up: "Error saving view: Error in select view conditions: View 'TABLEA' not found". I want to use the subquery to set specific fields/columns to select based on specific condition, but it doesn't work. Are there any other alternatives that would serve the purpose? Such as set conditions in the output?
user
09-02-2022 01:46:49 -0500

1 Answer

Hi, Generally , you could create subqueries from either FROM clause or in the WHERE clause of the query. You can use the IN operators and compare the output of a subquery which is defined in the[ SELECT](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/queries_select_statement/queries_select_statement#syntax-of-the-select-statement) statement's syntax. For instance, you can execute the below query in the VQL shell to obtain the result as expected. Then you could create a [derived view ](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/defining_a_derived_view/defining_a_derived_view#defining-a-derived-view)on top of the query. ``` SELECT * FROM TABLEA AS a WHERE column_name1 exists (SELECT b.column_name2 FROM TableB AS b WHERE a.column_name1 = b.column_name2) ``` It is important to note that the “IN” operator condition must be preceded by <,<=,=,<>,>=,> and followed by subquery. For more information you can take a look at the [“Subqueries in the WHERE Clause of the Query”](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/queries_select_statement/from_clause/subqueries_in_the_where_clause_of_the_query) section under Virtual DataPort VQL Guide. Hope this helps!
Denodo Team
10-02-2022 05:59:27 -0500
You must sign in to add an answer. If you do not have an account, you can register here