Filter, in the query..
Posted 17 July 2006 - 06:06 PM
That's my problem:
I have two table:
1. users - All user data
2. banish - user id and blob
My query will show me all not-baned users, so, I need to list the users from table 1, testing the table 2, and showing only who isn't in the second table..
simple like that, hard like itsef.. never do something like it..
Posted 17 July 2006 - 06:33 PM
Thanks anyway.. =))))
I'm editing this post:
My group leader (don't know how is called who is the project manager) give me a bad new.. this sql that I have the problem, use six table. Let me join you at the real-query problem..
I have that six table:
1. User data, all data
2. Task, all info about the task
3. Finished Task, info about the task that was finished with some manager entrys..
4. Events, like task
5. Finished Events, like finished task
6. Checked Users
Ok, my query will return ID and NAME from table 1, I've built like it:
Users in t1, where have an entry in t2, where have this entry finished in t3, where have an entry in t4, where have this entry finished in t5, where is not checked yet in t6*
*this one is the problem i've posted before
This is an AND case, t2>t3 AND t4>t5, right?
Now i ned an OR case.. to list it, t2>t3 OR t4>t5 OR both..
How i do this or inside the joins condition??? And how i correct the t6 problem without subquery?
Posted 19 July 2006 - 07:57 PM
SELECT tbC.nome_fantasia, tbC.id FROM tbClientes_PJ AS tbC LEFT JOIN tbPastas_Andamento AS tbPN LEFT JOIN tbPastas_Andamento_Realizadas AS tbAN ON tbAN.id_atividade = tbPN.id ON tbPN.id_cliente = tbC.id LEFT JOIN tbPastas_Atividade AS tbPA LEFT JOIN tbPastas_Atividade_Realizadas AS tbAR ON tbAR.id_atividade = tbPA.id ON tbPA.id_cliente = tbC.id LEFT JOIN tbAprovados AS tbA ON tbA.id_cliente = tbC.id WHERE ( tbA.id_cliente IS NULL ) AND ( ( tbPA.tipo_cliente =1 AND month( tbAR.data_alterada_inicial ) =7 ) OR ( tbPN.tipo_cliente =1 AND month( tbAN.data_alterada_inicial ) =7 ) ) GROUP BY tbC.nome_fantasia
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users