Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Can you set two fields to order records by?

 

like this:

 

ORDER BY fldOne ACS, ORDER BY fldTwo Asc

 

or something like that?

Being smarter than you look is always better than looking smarter than you are.
Posted

Yes Mothra you can. I have used that in many cases in some of my code. I will include a sample piece of code that I run all the time

 

sql = "Select PR_LNAME, PR_FNAME, PR_MINIT, PR_NUM " _
           & "from IGYPRMSD1 order by PR_LNAME asc, PR_FNAME asc;"

  • *Experts*
Posted

I know in SQL Server you can also ORDER BY ordinal position, such as:

SELECT Field1, Field2 FROM Table1
ORDER BY 1 asc, 2 desc -- or is it 0 asc, 1 desc?

 

This comes in handy if you have a complex SELECT, such as a CASE statement or subselect.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

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...