I've tried to create this query using JOIN/LEFTJOINOn et cetera to no 
luck. I can join tables in pairs, but I cannot chain the joins as I need 
here.

SELECT DISTINCT rh.id_pc
FROM mm,
      cc
      JOIN ras
        LEFT JOIN ras ras2
          ON (ras.id_server = ras2.id_server
          AND ras.id_pc = ras2.id_pc
          AND (ras2.id_gcc = cc.id_gcc
               OR ras2.id_gcc IS NULL)
          AND ras2.estat = "INACTIVE")
      JOIN rh
        LEFT JOIN rr
          ON (rh.id_pc = rr.id_pc
          AND rh.id_mm = rr.id_mm
          AND ras.id_server = rr.id_server)
WHERE ras.estat = "ACTIVE"
   AND ras.id_server = @ID_SERVER
   AND mm.id_mm = @ID_MM
   AND cc.id_cc = mm.id_cc
   AND (ras.id_gcc = cc.id_gcc
        OR ras.id_gcc IS NULL)
   AND ras2.id_ras IS NULL
   AND rh.id_mm = mm.id_mm
   AND rh.id_pc = ras.id_pc
   AND rr.id_mm_rights_revoked IS NULL;

I need to join cc with ras before the left join so that cc.id_gcc can be 
used in the ON condtion, but I have not found any way to do it using 
sqlbuilder. I need a one single query, I've got python verson that do the 
same in steps, but I need a single query.

I've written it in SQL and put the query inside _connection.queyALL, but I 
don't want to do this!!!

Can anybody help me?

Thanks
-- 

Pau

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to