0

我在 Apex 中对 POPUP LOV 使用了以下查询

select VEN_INVOICE_REFNO as display_value, VEN_INVOICE_REFNO as return_value 
  from VENDORINVOICE
 order by 1 asc;

我想按数字顺序(即按升序)向我显示图中所示的值。我已经尝试了我知道的所有可能的方法,但它不起作用。

在此处输入图像描述

4

5 回答 5

1

试试这个 ::

select VEN_INVOICE_REFNO as display_value, VEN_INVOICE_REFNO as return_value 
  from VENDORINVOICE
 order by ORDER BY CAST(`display_value` AS SIGNED)
于 2012-12-05T06:37:07.843 回答
1

您的字段数据类型似乎是字符串,将其转换为数字然后应用order by

select CAST(VEN_INVOICE_REFNO AS INTEGER) as display_value, VEN_INVOICE_REFNO as return_value 
 from VENDORINVOICE
 order by 1 asc;
于 2012-12-05T06:38:50.543 回答
1

我记得我曾经遇到过这个问题,我最终将它乘以 1

类似的东西(不确定它是否会起作用,您可能需要将 VEN_INVOICE_REFNO 转换为数字)

select (VEN_INVOICE_REFNO * 1) as display_value, VEN_INVOICE_REFNO as return_value 
  from VENDORINVOICE
 order by 1 asc;

像这样:

select CONVERT((VEN_INVOICE_REFNO * 1),UNSIGNED INTEGER) as display_value, VEN_INVOICE_REFNO as return_value 
  from VENDORINVOICE
 order by 1 asc;
于 2012-12-05T06:44:38.903 回答
1

如果任何记录具有非数字值,则此处的其他解决方案将不起作用,因此此处的 FWIW 是另一种解决方案:

select VEN_INVOICE_REFNO as display_value, VEN_INVOICE_REFNO as return_value 
from VENDORINVOICE
order by LPAD(VEN_INVOICE_REFNO,100,' ') asc;

只需更改100为列的最大大小即可。

但是,如果列有任何负数或小数(浮点)数值,我的解决方案将不起作用。

于 2012-12-06T07:01:25.710 回答
0

试试这个

选择 VEN_INVOICE_REFNO 作为 display_value,VEN_INVOICE_REFNO 作为 return_value 从 VENDORINVOICE order by VEN_INVOICE_REFNO

于 2012-12-05T06:47:03.813 回答