Hi , I don't know if this is possible with Sql but I'm trying to set the
row number into a field for each row.

The complexity comes when I try to do that according to some grouping
rules. 
I think I'll made myself more clear with a simple example:

This is the table I have

Column Id is primary key and auto_numeric


-----------------------------------------
Id      order   item    value   col_type
-----------------------------------------
1       3       15      0       null
2       3       15      5       null
3       3       15      0       null
4       8       22      7       null
5       8       22      0       null
6       10      64      20      null
-----------------------------------------

And this is the result I would like to obtain.
Where column col_type should be filled with a number
representing the ordinal number for the row within the 
group formed by order,item 

-----------------------------------------
Id      order   item    value   col_type
-----------------------------------------
1       3       15      0       1 <--This is row number 1 in the group 
2       3       15      5       2       formed by Order 3 and Item 15
3       3       15      0       3
4       8       22      7       1 <-This is row number 1
5       8       22      0       2 <-This is row number 2
6       10      64      20      1 <-This is row number 1
-----------------------------------------

I hope it is clear enough

All sugestions are welcome

Thanks 
Mauricio









-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to