Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Wanna-Be C# Superstar
Posted

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.

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...