Jump to content

Recommended Posts

Hey all,

Just a quick one (should be simple) - at the moment my database has a sorting function when using the screens.

However the Client Ref Number is a "String" fieldtype as the client can enter both numbers & letters.

 

However when sorting it shows the following:

Test

Testing

8044

8045

8046

22454

 

(Obviously sorting as a String rather than by numbers)

 

The to_number() in a sort throws an error as there are letters & symbols in the data.

 

Any ideas?

Regards,

Matt

Link to comment
https://forums.phpfreaks.com/topic/174435-sort-string-column-as-integer/
Share on other sites

Ok

My current code is:

  elseif ($sqlsort=="c.club_ref")
    $stmt="select * from (select c.contract_id,c.name,wc.EMAIL,wc.TELEPHONE,wc.MOBILE,c.our_ref,c.club_ref,to_char(c.sign_date,'DD-Mon-YYYY') sign_date,to_char(c.lastpay_date,'DD-Mon-YYYY') lastpay_date,c.lastpay_amt,c.stat_flag,row_number() over (ORDER BY c.club_ref desc) r from   web_members c, web_contracts wc where  c.login_id=:sucid and  c.club_id=:club_id and c.status = 'L' and c.contract_id = wc.contract_id) where r between :min_row and :max_row";

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.