Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select statement gives "no such table: " even though it is present. Workaround is if we add the table name as a comment in the sql. #108

Open
abhilash1jose opened this issue Jul 28, 2023 · 0 comments

Comments

@abhilash1jose
Copy link

SELECT DISTINCT a.Parent_Entity, a.Child_Entity, c1.Dataframe_number 'parent_number', d1.Dataframe_number 'child_number'
FROM local_process_driver_config_df c, df_foreign_keys a, local_process_driver_config_df d, local_process_driver_config_df_exploded c1, local_process_driver_config_df_exploded d1
WHERE a.Parent_Entity = c.Filename_in_process
AND c.Sl_no in ('2')
AND a.Child_Entity = d.Filename_in_process
AND d.Sl_no in ('2')
AND a.Parent_Entity IN (
SELECT DISTINCT b.Condition_Source_Entity_Left 'Entity_To_Be_Selected'
FROM df_mapping b
WHERE b.Condition_Source_Entity_Left <> 'Target_Extract'
UNION
SELECT DISTINCT b.Condition_Source_Entity_Right 'Entity_To_Be_Selected'
FROM df_mapping b
WHERE b.Condition_Source_Entity_Right <> 'Target_Extract')
AND a.Child_Entity IN (
SELECT DISTINCT b.Condition_Source_Entity_Left 'Entity_To_Be_Selected'
FROM df_mapping b
WHERE b.Condition_Source_Entity_Left <> 'Target_Extract'
UNION
SELECT DISTINCT b.Condition_Source_Entity_Right 'Entity_To_Be_Selected'
FROM df_mapping b
WHERE Condition_Source_Entity_Right <> 'Target_Extract')
AND c1.Dataframe_number = c.Dataframe_number
AND c1.Sl_no IN ('2','4')
AND d1.Dataframe_number = d.Dataframe_number
AND d1.Sl_no IN ('2','4')
AND (NOT EXISTS (SELECT 1 FROM local_process_driver_config_df_exploded c2
WHERE c2.Dataframe_number = c1.Dataframe_number
AND c2.Sl_no > '2'
AND (c2.Processing_time <> c1.Processing_time
OR c2.Filename_in_process <> c1.Filename_in_process))
OR NOT EXISTS (SELECT 1 FROM local_process_driver_config_df_exploded d2
WHERE d2.Dataframe_number = d1.Dataframe_number
AND d2.Sl_no > '2'
AND (d2.Processing_time <> d1.Processing_time
OR d2.Filename_in_process <> d1.Filename_in_process)))
/* checkingFROM local_process_driver_config_df, df_foreign_keys */

In the above query, if the last statement which is a comment enclosed with /* and */ is not provided, then the following error is shown "no such table: df_foreign_keys". But as a workaround, on adding a comment with the table names in the FROM list, the sql statement works. Can the sql made to work without the table name being added as a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant