If I do something like
SELECT * FROM mytable ORDER BY mycolumn ASC;
I get a result table in a specific order.
Is there a way in SQL
You can count the number of records where the value that you are sorting on has a lower value than the record that you know the key value of:
select count(*) from mytable where mycolumn < (select mycolumn from mytable where key = 42)