I need to search backwards through a database. I have successfully found the row I require in a table, based on a number being >= row 'start', and <= row 'end'.
SQL result
Host: localhost
Database : recruiting
Generation Time: Jan 13, 2004 at 05:17 PM
Generated by: phpMyAdmin 2.5.5-pl1
SQL-query: SELECT * FROM `federal-married` LIMIT 0, 30;
Rows: 7
id start end whamount percentage cap
1 0 333 0.00 0.00 0
2 333 929 0.00 0.10 333
3 929 2698 59.60 0.15 929
4 2698 4919 324.95 0.25 2698
5 4919 7731 880.20 0.28 4919
6 7731 13588 1667.56 0.33 7731
7 13588 99999999999 3600.37 0.35 13588
I've gotten as far as picking the row I need to start (say, determining someone is in the 2698-4919 row).
I now need to be able to work my way back through each row, find the 'whamount' and 'percentage' and 'cap' for row 3, same for row 2, finally stopping when there are no rows to go back to. (and then perform calculations based on each of these rows)
HELP!