If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > translate query - SQL Server - DB2 (newbie)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-04, 15:07
dstachon dstachon is offline
Registered User
 
Join Date: Jun 2003
Location: Ottawa
Posts: 105
translate query - SQL Server - DB2 (newbie)

Hi,

The following query, for SQL Server, does not work for DB2 7.1

can anyone give me a hand....

Code:
select m1.dealer_id
     , m1.manager as manager1
     , m2.manager as manager2
     , m3.manager as manager3
  from dealers as m1
left outer
  join dealers as m2
    on m1.dealer_id
     = m2.dealer_id 
   and m1.manager
     < m2.manager  
   and m2.manager
     = ( select min(manager)
           from dealers
          where dealer_id = m1.dealer_id 
            and manager > m1.manager )
left outer
  join dealers as m3
    on m1.dealer_id
     = m3.dealer_id   
   and m1.manager
     < m2.manager         
   and m2.manager
     < m3.manager                
 where m1.manager
     = ( select min(manager)
           from dealers
          where dealer_id = m1.dealer_id )
error message:
Code:
An ON clause associated with a JOIN operator is not valid.  SQLSTATE=42972
Reply With Quote
  #2 (permalink)  
Old 09-27-04, 16:48
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
From the manual on join-condition (the ON clause):

... It cannot contain any subqueries, scalar or otherwise.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-27-04, 20:54
dstachon dstachon is offline
Registered User
 
Join Date: Jun 2003
Location: Ottawa
Posts: 105
oh well...

thanks. appreciate the help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On