[Cialug] Alphabetical Sort

jim kraai jimgkraai at gmail.com
Wed Dec 11 19:23:18 CST 2013


This is known as a natural sort. There are many implementations in
procedural languages. (In the most general case, it's not solvable.)

If you google: natural sort in sql
there are a few pointers to work that's been started in mssql.

--jim

On Dec 11, 2013 7:06 PM, "Scott Yates" <Scott at yatesframe.com> wrote:

> Sorry, I missed the L in SQl.  lol
>
> If it is an option, you might consider creating a new field and running an
> SQL update on it to populate it with sort-formatted numbers derived from
> the problem field.  A SQL Insert/update trigger might be used to keep it in
> sync.
>
> This is off the top of my head, and there are a lot of domain specific
> things to think about, but this might point you in a more fruitful
> direction.
>
>
> On Wed, Dec 11, 2013 at 6:55 PM, Kenneth Younger <kyounger at gmail.com>
> wrote:
>
> > Which flavor of SQL are you using?
> >
> >
> > On Wed, Dec 11, 2013 at 5:35 PM, Patrick Mcgillan <
> > patrick.mcgillan at gmail.com> wrote:
> >
> > > I have this problem where a SQl field contains characters like this in
> > > different records.
> > >
> > > 1.4.1
> > > 1.4.10
> > > 1.4.2
> > > 1.5.1
> > > 1.5.10
> > > 1.5.11
> > > 1.5.12
> > > 1.5.2
> > > 1.5.3
> > > Trouble is, 1.4.2 should sort out before 1.4.10, but because it is a
> > > character field it doesn't. Now that makes perfectly good sense to me,
> > but
> > > not the customer. I can't sort on ID as the entries are randomly done.
> I
> > > sense that this problem has been solved before, but can't put my finger
> > on
> > > it.
> > >
> > > Can anybody point me in the proper direction.
> > >
> > > Patrick
> > > _______________________________________________
> > > Cialug mailing list
> > > Cialug at cialug.org
> > > http://cialug.org/mailman/listinfo/cialug
> > >
> > > --
> > > Kenneth Younger III
> > > Founder, Sheer Focus Inc.
> > > e: kenny at sheerfocus.com
> > > p: (515) 367-0001
> > > t: @kenny <http://twitter.com/kenny>
> > > <http://cialug.org/mailman/listinfo/cialug>
> > >
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org
> > http://cialug.org/mailman/listinfo/cialug
> >
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list