Get the App
SLTechnology News&Howtos  ›  Database  › 

Experience in using oracle statement

Shulou Source: shulou.com Published: 2022-06-01 07:06:25 10月04日 Update

SELECT

FROM (SELECT A1. , ROWNUM RN

FROM (SELECT H.*

FROM TBC_ADOWNBLK_HIST H

WHERE 1 = 1

ORDER BY adownblkid ASC) A1

WHERE ROWNUM = 1

If you want to sort, you have to write it this way.

-- add a prefix according to different dictionary values

Method one

Select CASE

WHEN dict_code = 'YYPZ' THEN' 0' | | CODE

ELSE'1' | | CODE end as code

Name as name

From MSTB_BDS_DATA

Where (dict_code = 'VOICEOTHERTYPE' or dict_code =' YYPZ')

And record_state ='1'

Method two

(select'0' | | CODE code,NAME from MSTB_BDS_DATA d where d.encoding codewords YYPZ' and record_state ='1') union all (select'1' | | CODE code,NAME from MSTB_BDS_DATA d where d.encoding codewords Voice _ and record_state ='1')

Tags: Methods different writing prefixes dictionaries sorting experience statements Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MySQL Xiaomi MariaDB Apple