G
Guest
I have a subquery that ranks test scores correctly until there is a
duplicate.
Table1 Results What I want
Score Rank Score rank Score Rank
68.4 78.4 1 78.4 1
46.6 73.4 2 73.4 2
34.0 70.0 3 70.0 3
78.4 68.4 5 68.4 4 <-- Want 4 twice
68.4 68.4 5 68.4 4 <-- and skip 5
70.0 57.8 6 57.8 6
57.8 46.6 7 46.6 7
73.4 34.0 8 34.0 8
I got the subquery code from a post last October and Marshall Barton
replied to my request for help with the correct SQL. I now get the desired
results in a Select Query.
Now the problem is that I need to update the source table (Table1). I used
the sql below but get an error msg: "Operation must use an updateable query".
I have read the HELP screen on this error but can not figure out how to code
it correctly.
UPDATE Table1 SET Table1.Rank = (select count(*)+1 from [table1] as x where
x.score > [table1].[score]);
The "(select count(*).... " sql code works as expected when used in a
SELECT, MAKE TABLE, or APPEND TABLE query but not an UPDATE query. I would
like to not use temp tables to get the updating done.
Thanks for any help
duplicate.
Table1 Results What I want
Score Rank Score rank Score Rank
68.4 78.4 1 78.4 1
46.6 73.4 2 73.4 2
34.0 70.0 3 70.0 3
78.4 68.4 5 68.4 4 <-- Want 4 twice
68.4 68.4 5 68.4 4 <-- and skip 5
70.0 57.8 6 57.8 6
57.8 46.6 7 46.6 7
73.4 34.0 8 34.0 8
I got the subquery code from a post last October and Marshall Barton
replied to my request for help with the correct SQL. I now get the desired
results in a Select Query.
Now the problem is that I need to update the source table (Table1). I used
the sql below but get an error msg: "Operation must use an updateable query".
I have read the HELP screen on this error but can not figure out how to code
it correctly.
UPDATE Table1 SET Table1.Rank = (select count(*)+1 from [table1] as x where
x.score > [table1].[score]);
The "(select count(*).... " sql code works as expected when used in a
SELECT, MAKE TABLE, or APPEND TABLE query but not an UPDATE query. I would
like to not use temp tables to get the updating done.
Thanks for any help