Database versioning

前端 未结 7 1749
抹茶落季
抹茶落季 2021-01-06 20:30

I have made few projects (CMS and EC system) that required to have some data versioned.

Usually I come with that kind of schema

+--------------+
+          


        
7条回答
  •  长发绾君心
    2021-01-06 20:55

    If you had used Oracle you could use analytic functions

    select * from ( SELECT a.* , row_number() over (partition by foobar_id order by version desc) rn FROM foobar a WHERE foobar_id = 2 ) where rn = 1

提交回复
热议问题