title: Equivalent to subquery without TOP or ORDER BY in HANA SQL
body: <p>The SAP SQL Converter gave me this as output:</p>
  
  <pre><code>SELECT c."id", c."key_link", 
      (SELECT TOP 1 "notes_extra" 
      FROM "Orders" c2 
      WHERE c2."id" = c."id" AND c2."start" &lt; c."start" 
      ORDER BY c2."start" DESC) AS "previous_notes" 
  FROM "Orders" c
  ORDER BY c."id";
  </code></pre>
  
  <p>Unfortunately, SAP HANA SPS 10 does not accept it:<br>
  <strong>SAP DBTech JDBC: [309]: correlated subquery cannot have TOP or ORDER BY</strong></p>
  
  <p>I am struggeling converting the query into something without TOP and ORDER BY. Tried a few things with <code>WHERE "start" = (SELECT MAX("start")</code> but since "start" can have duplicate values, I end up with: <strong>SAP DBTech JDBC: [305]: single-row query returns more than one row</strong></p>
  
  <p>So what's the correct equivalent in HANA SQL?</p>
  
  <p><strong>Edit:</strong><br> It seems to add to the problem that the column "notes_extra" is of type NCLOB. Any alternative I try to come up with ends at some point in an aggregate function (MAX, FIRST_VALUE, ...) on this column, which results in: <strong>SAP DBTech JDBC: [264]: invalid datatype: LOB Type in aggregation func</strong></p>