Sql . 把它放在一个答案里,它就会被选中。很有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”LOB类型的“previous\u note

Sql . 把它放在一个答案里,它就会被选中。很有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”LOB类型的“previous\u note,sql,subquery,hana,Sql,Subquery,Hana,. 把它放在一个答案里,它就会被选中。很有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”LOB类型的“previous\u notes”不能使用-这也排除了所有分组方式的“notes\u extra”:\有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”


. 把它放在一个答案里,它就会被选中。很有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:
SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”LOB类型的“previous\u notes”不能使用
-这也排除了所有
分组方式的“notes\u extra”
:\有趣!不幸的是,在我的例子中,“notes\u extra”不适用于以下情况:
SAP DBTech JDBC:[264]:无效的数据类型:“C.notes\u extra”LOB类型的“previous\u notes”不能使用
-这也排除了所有
分组方式的“notes\u extra”
:\
SELECT c."id", c."key_link", 
    (SELECT TOP 1 "notes_extra" 
    FROM "Orders" c2 
    WHERE c2."id" = c."id" AND c2."start" < c."start" 
    ORDER BY c2."start" DESC) AS "previous_notes" 
FROM "Orders" c
ORDER BY c."id";
SELECT c."id", c."key_link", 
       lag(c."notes_extra") over (partition by c."id" order by c."start" desc) as "previous_notes" 
FROM "Orders" c
ORDER BY c."id";
 select "id", "notes_extra" from 
     (SELECT c."id", c."notes_extra" 
            , row_number () over 
               (partition by c."id" 
                ORDER BY c."id" asc , c."start" desc) as RN 
      FROM orders c ) 
  where rn =2;