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
SELECT DISTINCT rh.id_pc
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")
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?
On Wed, Jul 05, 2006 at 04:47:10PM +0200, Pau Aliagas wrote:
> 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
Join could be a list:
MyTable.select(where_clause, join=[LEFTJONON(...), STRIGHTJOIN(...)])
Oleg Broytmann http://phd.pp.ru/ phd@...
Programmers don't die, they just GOSUB without RETURN.