Hi,
I have created a query that accumulates various columns of information from
different tables. In this query the user selects, as criteria for a "musym"
field, a value (i.e. 38E) of interest for subsequent export of the accumulated information for that specific value into excel. However, before export I would like to add a column to the query that will contain a "ranking" number for every unique "siteiid" value in the query, listed sequentially. Since the number will be based on a particular record id, in this case "siteiid", and many rows may have the same ID,this is not really a row count. For example, my query result may look like this
siteiid musym
450 38E
450 38E
450 38E
450 38E
450 38E
451 38E
451 38E
451 38E
451 38E
451 38E
604 38E
604 38E
604 38E
604 38E
604 38E
610 38E
610 38E
610 38E
610 38E
610 38E
611 38E
611 38E
611 38E
611 38E
There are 24 rows in this example, but only 5 different, unique "siteiid"
designations. So what I need is new column that displays the a "ranking" of those ID's. So the new column will look something like this:
Rank siteiid musym
1 450 38E
1 450 38E
1 450 38E
1 450 38E
1 450 38E
2 451 38E
2 451 38E
2 451 38E
2 451 38E
2 451 38E
3 604 38E
3 604 38E
3 604 38E
3 604 38E
3 604 38E
4 610 38E
4 610 38E
4 610 38E
4 610 38E
4 610 38E
5 611 38E
5 611 38E
5 611 38E
5 611 38E
So now I have one number for all unique, siteiid labels regardless of how
many times each one is duplicated in the table. Thanks for any help.
I have created a query that accumulates various columns of information from
different tables. In this query the user selects, as criteria for a "musym"
field, a value (i.e. 38E) of interest for subsequent export of the accumulated information for that specific value into excel. However, before export I would like to add a column to the query that will contain a "ranking" number for every unique "siteiid" value in the query, listed sequentially. Since the number will be based on a particular record id, in this case "siteiid", and many rows may have the same ID,this is not really a row count. For example, my query result may look like this
siteiid musym
450 38E
450 38E
450 38E
450 38E
450 38E
451 38E
451 38E
451 38E
451 38E
451 38E
604 38E
604 38E
604 38E
604 38E
604 38E
610 38E
610 38E
610 38E
610 38E
610 38E
611 38E
611 38E
611 38E
611 38E
There are 24 rows in this example, but only 5 different, unique "siteiid"
designations. So what I need is new column that displays the a "ranking" of those ID's. So the new column will look something like this:
Rank siteiid musym
1 450 38E
1 450 38E
1 450 38E
1 450 38E
1 450 38E
2 451 38E
2 451 38E
2 451 38E
2 451 38E
2 451 38E
3 604 38E
3 604 38E
3 604 38E
3 604 38E
3 604 38E
4 610 38E
4 610 38E
4 610 38E
4 610 38E
4 610 38E
5 611 38E
5 611 38E
5 611 38E
5 611 38E
So now I have one number for all unique, siteiid labels regardless of how
many times each one is duplicated in the table. Thanks for any help.
Last edited: