Just as the title says, I need a query to count the rows until the condition is met. Here's my setup:
So if I'm going to search for partnumber = d it will sort the part number and return 4 (since d is the 4th when you sort the partnumber).
I can do this inside a loop. I'm just wondering if there is a query for this.
Thanks in advanced...
SELECT COUNT(*) FROM THE_TABLE WHERE partnumber <= (SELECT ID FROM THE_TABLE WHERE partnumber <= 'd');