From: mark on
Hi,

I have a query that runs fine with SQL Server but gives me an
exception with DB2

Part of the query using join operator and the ON clause contains
subquery.
The exception I am getting is the following:

An ON clause associated with a JOIN operator or in a MERGE statement
is
not valid for one of the following reasons.
* The ON clause cannot include any subqueries.
......

Should I re-write the query for DB2 that would be different in this
case from what I am using with SQL Server or there is another way to
do it?
From: Ian on
On 4/20/10 11:25 AM, mark wrote:
> I have a query that runs fine with SQL Server but gives me an
> exception with DB2
>

It would be useful if you actually posted the query that you're
having a problem with.


From: --CELKO-- on
"A problem well stated is a problem half solved." -- Charles F.
Kettering

It is very hard to debug code when you do not let us see it.

Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. If you know how, follow ISO-11179 data element naming
conventions and formatting rules. Temporal data should use ISO-8601
formats. Code should be in Standard SQL as much as possible and not
local dialect.

Sample data is also a good idea, along with clear specifications. If
you want to learn how to ask a question on a Newsgroup, look at:
http://www.catb.org/~esr/faqs/smart-questions.html

From: Serge Rielau on
On 4/20/2010 11:55 PM, mark wrote:
> Hi,
>
> I have a query that runs fine with SQL Server but gives me an
> exception with DB2
>
> Part of the query using join operator and the ON clause contains
> subquery.
> The exception I am getting is the following:
>
> An ON clause associated with a JOIN operator or in a MERGE statement
> is
> not valid for one of the following reasons.
> * The ON clause cannot include any subqueries.
> .....
>
> Should I re-write the query for DB2 that would be different in this
> case from what I am using with SQL Server or there is another way to
> do it?
That is what the message is saying, yes.


--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab