Darkness Soul Posted July 17, 2006 Share Posted July 17, 2006 Yo,That's my problem:I have two table:1. users - All user data2. banish - user id and blobMy 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..thanks,D.Soul Quote Link to comment Share on other sites More sharing options...
fenway Posted July 17, 2006 Share Posted July 17, 2006 Sounds like a simple left join... do you already have some sort of query that doesn't work as expected? Quote Link to comment Share on other sites More sharing options...
Darkness Soul Posted July 17, 2006 Author Share Posted July 17, 2006 [b]SOLVED!!!!!![/b]Thanks anyway.. =))))D.Soul~~~~~~~~~~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 data2. Task, all info about the task3. Finished Task, info about the task that was finished with some manager entrys..4. Events, like task5. Finished Events, like finished task6. Checked UsersOk, 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 beforeThis 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?Thanks,D.Soul Quote Link to comment Share on other sites More sharing options...
fenway Posted July 18, 2006 Share Posted July 18, 2006 Could you post the solution? Quote Link to comment Share on other sites More sharing options...
Darkness Soul Posted July 19, 2006 Author Share Posted July 19, 2006 Sure!! =)[code]SELECTtbC.nome_fantasia, tbC.idFROMtbClientes_PJ AS tbCLEFT JOINtbPastas_Andamento AS tbPNLEFT JOINtbPastas_Andamento_Realizadas AS tbANONtbAN.id_atividade = tbPN.idONtbPN.id_cliente = tbC.idLEFT JOINtbPastas_Atividade AS tbPALEFT JOINtbPastas_Atividade_Realizadas AS tbARONtbAR.id_atividade = tbPA.idONtbPA.id_cliente = tbC.idLEFT JOINtbAprovados AS tbAONtbA.id_cliente = tbC.idWHERE(tbA.id_cliente IS NULL)AND((tbPA.tipo_cliente =1ANDmonth( tbAR.data_alterada_inicial ) =7)OR(tbPN.tipo_cliente =1ANDmonth( tbAN.data_alterada_inicial ) =7))GROUP BYtbC.nome_fantasia[/code]D.Soul Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.