mysql select ordernumber by group -


I'm trying to do something like 'Select the group max', but I'm looking for a group-wise order number.

Then with a table like this

  short description ---------- id_brief | Id_case | Date 1 | 1 | 06/07/2010 2 | 1 | 04/07/2010 3 1 | 03/07/2010 4 2 | 18/05/2010 5 2 | 17/05/2010 6 2 | 19/05/2010   

I want a result like this

  breifs results ---------- id_brief | Id_case | Date order 1 1 | 3 2 1 | 2 3 | 1 | 1 4 | 2 | 2 5 | 2 | 1 6 | 2 | 3   

I think I want to do something as described here, but I do not know how I will reset the variable for each id_case.

This will give you id_case with how many records and this A date of equal or less than the date value.

  SELECT t1.id_brief, t1.id_case, COUNT (T2 *) AS yourtable AS t1 LEFT T2 ON T2 ON T2 ON T2 ON T2 ON T2 ON and T2 DOT & LT; = T1 Detet Group by T.Id_Briff   

It is acceptable about Mykkil column that Group BY With one more stick DBMS you may need the GROUP BY t1.id_brief, t1.id_case .

I recommend strongly correct on the index :

  Make your volume filter (IDCCase , Date)    

Comments