PARTITION BY doesn't work in H2 db

此生再无相见时 提交于 2019-12-05 13:39:53

I don't think H2 supports window functions (aka analytic functions). However, you can do the query in the link using standard SQL:

SELECT t.*
FROM yourtable t join
     (select vendorname, max(incidentdate) as maxdate
      from yourtable yt
      group by vendorname
     ) vn
     on vn.vendorname = yt.vendorname
ORDER BY vn.maxDate DESC, t.VendorName ASC, t.IncidentDate DESC;

Although this should run in both environments, the over form probably performs better in SQL.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!