VBAHole22 Posted December 10, 2004 Posted December 10, 2004 I need to run a query against Oracle that returns a set of records but I only care about the top one (it's ordered). How can I get this one record back? Right now I am using a datareader and not using the While dr.Read syntax. I think this is giving me the first record but I'm unsure if it is the best way to do it. Any suggestions? Quote Wanna-Be C# Superstar
*Gurus* Derek Stone Posted December 10, 2004 *Gurus* Posted December 10, 2004 http://www.orafaq.com/faqsql.htm#TOP Quote Posting Guidelines
VBAHole22 Posted December 10, 2004 Author Posted December 10, 2004 Sweet. SELECT * FROM (SELECT AField FROM my_table ORDER BY col_name_1 DESC) WHERE ROWNUM < 10; Now I can use a command and ExecuteScalar. Tank you. Quote Wanna-Be C# Superstar
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.