mysql - Inner Join between three tables -


i'm using following query:

select a.idclientecrm, max(c.falta) clientescrmporlistadeclientescrm inner join clientescrmporlistadeclientescrm b on (a.idclientecrm=b.idclientecrm ,   a.idlistadeclientescrm = 58) inner join tareas c on a.idclientecrm=c.idclientecrm b.idlistadeclientescrm = 70 

but i'm not getting result want. know i'm doing wrong don't know what.

i want outcome of first inner join (aprox 22k rows) need join result "tareas" table , max date there.

i want use max because every idclientecrm, there's more 1 row matches in "tareas" table , need last recorded result.

if left out let me know.

thnx in advance!

you want move "58" condition clause , group on a.idclientecrm:

select a.idclientecrm, max(c.falta)  clientescrmporlistadeclientescrm inner join clientescrmporlistadeclientescrm b  on a.idclientecrm = b.idclientecrm inner join tareas c  on a.idclientecrm = c.idclientecrm b.idlistadeclientescrm = 70 , a.idlistadeclientescrm = 58 group a.idclientecrm 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -