Em 13/03/2010 21:23, Timo Sirainen escreveu:
So are you saying that the users table contains only local users, while
some domain table contains all domains and their destination servers?
Then you'll just need to do outer join. Something like:

.., domains.host as host, 'Y' as proxy_maybe, ..
from domains
outer join emails on (username = '%u')
where domain.domain = '%d'

Timo i've tried JOINs, but i've never really understood those crazy things (i'm really very far from being a SQL expert).

but seems i got the expected results using UNION and adjusting queries to have the same number of columns. First i tried union with normal queries but couldnt get it because queries must have the same number of rows. Then i adjusted it ... and seems its OK.

Please check resultsets when querying a LOCAL user and when querying with a NON-local (to be proxied) user. Do you think this query will make things work as i need ?


    querying a LOCAL user:
http://pastebin.com/L3q6HGrA

    querying a NON-local (to be proxied) user:
http://pastebin.com/fV91LB0x

querying a NON-local and NOT-to be proxied user (correctly returns an empty resultset)
http://pastebin.com/SBwCEVEm


--


        Atenciosamente / Sincerily,
        Leonardo Rodrigues
        Solutti Tecnologia
        http://www.solutti.com.br

        Minha armadilha de SPAM, NÃO mandem email
        gertru...@solutti.com.br
        My SPAMTRAP, do not email it




Reply via email to