Q:

Order By in Ascending Order

i have used the following query for POPUP LOV in Apex 
select VEN_INVOICE_REFNO as display_value, VEN_INVOICE_REFNO as return_value 
  from VENDORINVOICE
 order by 1 asc;

i want to show me the values as shown in diagram in numeric order i-e in ascending order.i have tried all the possible ways which i know but it don't  works.

A:

it seem that your field datatype is string, convert it into numeric then apply the order by
select CAST(VEN_INVOICE_REFNO AS INTEGER) as display_value, VEN_INVOICE_REFNO as return_value 
 from VENDORINVOICE
 order by 1 asc;

