I met some trouble while using mysql, In fact I have a table formated like that:
n_doss etat date etc...
-----------------------------------
145 N 20/10
145 EC 15/10
146 N 25/10
What I would like to do is for each etat
to count how much folder I have (folders are identified by n_doss
).
the trouble is that the last etat
that is important is the most recent for each file.
So I have to count for each etat
how much file I have, but I can not count each etat
for each n_doss
but just the most recent.
I've tried almost everything but I can not succeed in this query.
I've tried:
SELECT `etat` , `n_doss`, COUNT( 'etat' )
FROM `commentaire` WHERE
GROUP BY `etat`
This does not work with what I try to do.
I also tried
SELECT `etat` , `n_doss`, COUNT( 'etat' )
FROM `commentaire`
GROUP BY `n_doss`
HAVING max(date) with
with acualy no success. Any kind of help will be much appreciated.