Complex SQL Statement
-
- Posts: 3
- Joined: Tue Oct 10, 2017 12:44 pm
Complex SQL Statement
Is there a way to use the "EXISTS" in the where clause of a SQL statement?____select * from table 1 __where exists (select * from table 2 where table2.xxx = table1.xxx)____TIA__Mark
=> RE: Complex SQL Statement
I just tried this User SQL against the SQL Server pubs sample database using the Microsoft SQL Server driver and it worked without a problem.______select * from dbo.publishers __where exists__(SELECT * from dbo.pub_info where publishers.pub_id = pub_info.pub_id )______Kathleen__R&R Support
-
- Posts: 3
- Joined: Tue Oct 10, 2017 12:44 pm
==> RE: Complex SQL Statement
The question is how to enter the "EXISTS" statement into the R&R query builder.____Mark
-
- Posts: 3
- Joined: Tue Oct 10, 2017 12:44 pm
===> RE: Complex SQL Statement
As it turnes out it was not the "EXISTS" part of the statement that was causing the error. I zeroed in on that as it was the only thing complex in the statement. ____In fact the problem turned out to be the handling of the following which I omitted from the first post as I did not suspect it.____select field1 as billed_amt____The parser cannot handle the as clause. Removing that clause and the query worked fine. Sorry for the misdirection but I thought I would send this to document the behavior for others.____Mark
====> RE: Complex SQL Statement
Thanks for the update.____Kathleen__R&R Support