If I have a table with columns id, name, score, date
and I wanted to run a sql query to get the record where id = 2 with the earliest date in the data set.
Can you do this within the query or do you need to loop after the fact?
I want to get all of the fields of that record..
If you just want the date:
If you want all of the information:
Prevent loops when you can. Loops often lead to cursors, and cursors are almost never necessary and very often really inefficient.