Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 12:59 AM
RR
Guest
 
Posts: n/a
Default Sorting or Grouping problem

How could I make a text field sort in the following way?

2CBE00001 2CBE00001
2CBE00002 2CBE01001
2CBE00003 2CBE02001
2CBE01001 2CBE00002
2CBE01002 2CBE01002
2CBE01003 2CBE02002
2CBE02001 2CBE00003
2CBE02002 2CBE01003
2CBE02003 2CBE02003

Any help would be greatly appreciated
Thanks
Dave


  #2  
Old November 13th, 2005, 12:59 AM
Squirrel
Guest
 
Posts: n/a
Default Re: Sorting or Grouping problem

Dave,

If characters 1 through 5 and 7 through 8 are truly constant then this will
do the sort.

SELECT Field1 FROM Table1 ORDER BY Mid([Field1],9,1), Mid([Field1],6,1);

Linda


"RR" <dlanham747@prodigy.net> wrote in message
news:4q4Bc.370$DI4.210@newssvr32.news.prodigy.com. ..[color=blue]
> How could I make a text field sort in the following way?
>
> 2CBE00001 2CBE00001
> 2CBE00002 2CBE01001
> 2CBE00003 2CBE02001
> 2CBE01001 2CBE00002
> 2CBE01002 2CBE01002
> 2CBE01003 2CBE02002
> 2CBE02001 2CBE00003
> 2CBE02002 2CBE01003
> 2CBE02003 2CBE02003
>
> Any help would be greatly appreciated
> Thanks
> Dave
>
>[/color]


  #3  
Old November 13th, 2005, 12:59 AM
Randy Harris
Guest
 
Posts: n/a
Default Re: Sorting or Grouping problem


"RR" <dlanham747@prodigy.net> wrote in message
news:4q4Bc.370$DI4.210@newssvr32.news.prodigy.com. ..[color=blue]
> How could I make a text field sort in the following way?
>
> 2CBE00001 2CBE00001
> 2CBE00002 2CBE01001
> 2CBE00003 2CBE02001
> 2CBE01001 2CBE00002
> 2CBE01002 2CBE01002
> 2CBE01003 2CBE02002
> 2CBE02001 2CBE00003
> 2CBE02002 2CBE01003
> 2CBE02003 2CBE02003
>
> Any help would be greatly appreciated
> Thanks
> Dave[/color]

Dave, you haven't made what you hope to accomplish very clear. Is it that
you want it sorted by the last four characters in reverse sequence? Or,
perhaps the last 5?


  #4  
Old November 13th, 2005, 12:59 AM
Larry Linson
Guest
 
Posts: n/a
Default Re: Sorting or Grouping problem

Maybe it's really a problem in pattern recognition?

"Randy Harris" <randy@SpamFree.com> wrote in message
news:mCaBc.26066$eH1.12255631@newssvr28.news.prodi gy.com...[color=blue]
>
> "RR" <dlanham747@prodigy.net> wrote in message
> news:4q4Bc.370$DI4.210@newssvr32.news.prodigy.com. ..[color=green]
> > How could I make a text field sort in the following way?
> >
> > 2CBE00001 2CBE00001
> > 2CBE00002 2CBE01001
> > 2CBE00003 2CBE02001
> > 2CBE01001 2CBE00002
> > 2CBE01002 2CBE01002
> > 2CBE01003 2CBE02002
> > 2CBE02001 2CBE00003
> > 2CBE02002 2CBE01003
> > 2CBE02003 2CBE02003
> >
> > Any help would be greatly appreciated
> > Thanks
> > Dave[/color]
>
> Dave, you haven't made what you hope to accomplish very clear. Is it that
> you want it sorted by the last four characters in reverse sequence? Or,
> perhaps the last 5?
>
>[/color]


  #5  
Old November 13th, 2005, 01:17 AM
Mr. Smith
Guest
 
Posts: n/a
Default Re: Sorting or Grouping problem

Squirrel wrote:
[color=blue]
> Dave,
>
> If characters 1 through 5 and 7 through 8 are truly constant then this will
> do the sort.
>
> SELECT Field1 FROM Table1 ORDER BY Mid([Field1],9,1), Mid([Field1],6,1);
>
> Linda
>
>
> "RR" <dlanham747@prodigy.net> wrote in message
> news:4q4Bc.370$DI4.210@newssvr32.news.prodigy.com. ..
>[color=green]
>>How could I make a text field sort in the following way?
>>
>>2CBE00001 2CBE00001
>>2CBE00002 2CBE01001
>>2CBE00003 2CBE02001
>>2CBE01001 2CBE00002
>>2CBE01002 2CBE01002
>>2CBE01003 2CBE02002
>>2CBE02001 2CBE00003
>>2CBE02002 2CBE01003
>>2CBE02003 2CBE02003
>>
>>Any help would be greatly appreciated
>>Thanks
>>Dave
>>
>>[/color]
>
>
>[/color]


Or....

SELECT Field1 FROM Table1 ORDER BY Right([fieldname],1) ASC,
Mid([Field1],6,1) ASC
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles