簡體   English   中英

如何在下拉列表中顯示值的小寫/大寫時不區分大小寫

[英]How to make sort case insensitive while displaying the lower+upper case of values in the dropdown

我正在嘗試將查詢結果轉換為,並按升序將它們根據小寫字母排序。 但是在顯示時,我需要保留所有原始大小寫(小寫和大寫)。

我的查詢看起來像這樣-

SELECT distinct (p.product_id) as product_id ,lcase(p.product_name) as product_name 
from library TL, product p
WHERE TL.id = PL.id 
AND pL.product_id = p.product_id 
AND pL.product_id NOT IN (0)
order by lcase(product_name) asc;

但是當我顯示它時,會將整個下拉列表的值更改為小寫。 這不是我想要的。 我只希望它按照小寫的順序顯示。

我該怎么做?

據我所知,我的orderby應該和select不是一樣的條件嗎?

如何在下拉列表中顯示值的小寫/大寫時不區分大小寫

你可以試試看

SELECT product_id, product_name FROM (
    SELECT distinct (p.product_id) as product_id ,(p.product_name) as product_name,  
    lcase(p.product_name) as pname
    from unified.techlibrary TL, unified.techlibraryprod PL, unified.product p, unified.contenttype CT 
    WHERE TL.id = PL.id 
    AND pL.product_id = p.product_id 
    AND tl.contenttype_id in (1,3)  
    AND pL.product_id NOT IN (0)
) AS x order by x.pname

希望它會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM