I want to create a sequence of values for a column in one of my tables in
the model class. The sequence number is updated every time a new rows is
added to the table. The sequence number is reset to zero when a foreign key
value changes. Is this possible, and how would I do it?

Here is the example table:

id | fk1 | sequence_number | some data in other columns
 1 |  2   |           1                 |       xxx
 2 |  2   |           2                 |       yyy
 3 |  2   |           3                 |       zzz
 4 |  4   |           1                 |       xxx
 5 |  4   |           2                 |       yyy
 6 |  4   |           3                 |       zzz

Basically, I have sets of data determined by a foreign key, and I want to
know the order in which the rows arrive within a data set.

Thanks for your suggestions!

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to