Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    From the manual on join-condition (the ON clause):

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

    Andy

  3. #3
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    oh well...

    thanks. appreciate the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •