Fixed SQL Select only rows with Max Value on a Column #dev #it #asnwer
Fixed SQL Select only rows with Max Value on a Column #dev #it #asnwer
SQL Select only rows with Max Value on a Column
I have this table for documents (simplified version here):
++-++ | id | rev | content | ++-++ | 1 | 1 | ... | | 2 | 1 | ... | | 1 | 2 | ... | | 1 | 3 | ... | ++-++
How do I select one row per id and only the greatest rev? With the above data, the result should contain two rows: [1, 3, ...] and [2, 1, ..]. I’m using MySQL.
Currently I use checks in…
View On WordPress







