Jump to content

Sorting varchar data numerically


yashshah

Recommended Posts

Hey guys i have this problem here,

I have some data which goes like

1900

1899

1898

 

100

C-1

C-21

C-100

A-200

A-100

etc..

 

These are basically item codes which needs to be sorted numerically. This column rite now is of varchar type.

The data what i am looking for is something like

 

1900

1899

1898

A-200

A-100

C-100

C-21

C-1

 

This is killing my project here and my dean wont accept the project without this..Need help badly.

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/209258-sorting-varchar-data-numerically/
Share on other sites

Well not really.. I need them sorted according to the item codes.

The codes go as.

 

2000 to say 100.

A few have C-200 to C-01

A few are U-200 to U-01

Others would be BU-200 to U-01.

 

What is desirable is that the numbers get sorted desc first. Followed with an alphabet sorting along with a numerical sort approach.

 

Let me know if you dont understand what im saying here.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.