The post below made me think of another question..

# Thread: The post below made me think of another question..

1. Senior Member
Join Date
Dec 1969
Posts
1,671

## The post below made me think of another question..

I&#039ve seen drop-downs that allow people to sort data by any letter. If I say I want to start with the letter &#039S&#039, how do I display results ordered from S-Z followed by A-R?

2. Dan
Senior Member
Join Date
Dec 1969
Posts
1,364

## RE: The post below made me think of another questi

i am not sure i follow ?

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## RE: The post below made me think of another questi

Good question!<BR><BR>Lots of ways, but what would be the most efficient?<BR><BR>Hmmm....<BR><BR>Obviously you could use two queries:<BR><BR>SELECT ... WHERE fld &#062;= &#039R&#039 ORDER BY fld<BR>SELECT ... WHERE fld &#060; &#039R&#039 ORDER BY fld<BR><BR>That actually wouldn&#039t be too bad.<BR><BR>Or maybe do a single query, move the results into an array, find where the "R"s start in the array, output from there to the end and then go from beginning to there?<BR><BR>Something like:<BR><BR>&#060;%<BR>Set RS = conn.Execute ...<BR>allRows = RS.GetRows<BR><BR>&#039 find where R is...<BR>startat = 0<BR>For i = 0 To UBound( allRows, 2 )<BR>&nbsp; &nbsp; If allRows( keyColumn, i ) &#062;= "R" Then<BR>&nbsp; &nbsp; &nbsp; &nbsp; startat = i<BR>&nbsp; &nbsp; &nbsp; &nbsp; Exit For<BR>&nbsp; &nbsp; End If<BR>Next<BR><BR>For i = startat To UBound( allRows, 2 )<BR>&nbsp; &nbsp; Response.Write "&#060;OPTION&#062;" & allRows(keyColumn,i) & vbNewLine<BR>Next<BR>For i = 0 To (i - 1)<BR>&nbsp; &nbsp; Response.Write "&#060;OPTION&#062;" & allRows(keyColumn,i) & vbNewLine<BR>Next<BR>%&#062;<BR><BR>How&#039s that?<BR><BR><BR><BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,671

## RE: The post below made me think of another questi

Oooh. I like the array idea. I don&#039t have an immediate use for it, but I sure wanted to know for future reference. <BR><BR>It&#039s nice to make searching as easy as possible for people who visit your site, eh?<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•