嵌套查询 Sql Oracle 排序

Nested Query Sql Oracle Sort

任何人都可以给我正确的语法来对这个查询进行排序吗?我想根据列 DocNum desc 和 LineNo asc

进行排序

谢谢

 select distinct * from (
    select a.ildoc"DocNum", replace(round(a.illnid/1000,2),',','.')"LineNo", 
    replace(round(a.iltgn/1000,2),',','.')"TrnsctionGroup",
    case when a.ilfrto = 'F' then
      'From'
    else
      'To'
    end"F/T", 
    a.ilitm"Item", c.imdsc1"Desc",
    replace(round(a.iltrqt/10000,2),',','.')"Qty", a.illotn"LotSerial",
    case when INSTR(a.illotn,': ') = 0 then
      ' '
    else
      to_char(substr(a.illotn,INSTR(a.illotn,': ')+2))
    end"Serial",
    d.iolot1"Memo1", d.iolot2"Memo2"
    from proddta.f4111 a
    inner join proddta.f4111 e on a.ildoc = e.ildoc
    inner join proddta.f4101 c on c.IMITM = a.ilitm
    left join proddta.f4108 d on a.illotn = d.iolotn and d.iomcu = a.ilmcu and
    d.ioITM = a.ilitm
    where a.ilmcu = 18001 and a.ildct = 'IE'
    and e.ilitm = 56233
    order by a.ildoc desc, a.iljeln asc
    )--order by a.ildoc"DocNum" desc, a.iljeln asc
SELECT DISTINCT *
  FROM (  SELECT a.ildoc
                     "DocNum",
                 REPLACE (ROUND (a.illnid / 1000, 2), ',', '.')
                     "LineNo",
                 REPLACE (ROUND (a.iltgn / 1000, 2), ',', '.')
                     "TrnsctionGroup",
                 CASE WHEN a.ilfrto = 'F' THEN 'From' ELSE 'To' END
                     "F/T",
                 a.ilitm
                     "Item",
                 c.imdsc1
                     "Desc",
                 REPLACE (ROUND (a.iltrqt / 10000, 2), ',', '.')
                     "Qty",
                 a.illotn
                     "LotSerial",
                 CASE
                     WHEN INSTR (a.illotn, ': ') = 0
                     THEN
                         ' '
                     ELSE
                         TO_CHAR (
                             SUBSTR (a.illotn, INSTR (a.illotn, ': ') + 2))
                 END
                     "Serial",
                 d.iolot1
                     "Memo1",
                 d.iolot2
                     "Memo2"
            FROM proddta.f4111 a
                 INNER JOIN proddta.f4111 e ON a.ildoc = e.ildoc
                 INNER JOIN proddta.f4101 c ON c.IMITM = a.ilitm
                 LEFT JOIN proddta.f4108 d
                     ON     a.illotn = d.iolotn
                        AND d.iomcu = a.ilmcu
                        AND d.ioITM = a.ilitm
           WHERE a.ilmcu = 18001 AND a.ildct = 'IE' AND e.ilitm = 56233
        ORDER BY "DocNum" DESC, a.iljeln ASC)