比方說,我有如下表:選擇從表(MS SQL Server中,SQLite的)最新版本
ID | UID | Version | Content
---+-----+---------+-----------------------------
1 | 1 | 1 | Something
2 | 1 | 2 | Something (changed)
3 | 2 | 1 | Alice has a cat
4 | 2 | 2 | Alice has a cat and a dog
5 | 2 | 3 | Alice has a cat and a canary
我需要創建查詢,這將返回所有對象,但只有最新版本,所以在這種情況下:
ID | UID | Version | Content
---+-----+---------+-----------------------------
2 | 1 | 2 | Something (changed)
5 | 2 | 3 | Alice has a cat and a canary
由於SQL方言不同,我會運行MS SQL Server 2008上的這個查詢的SQLite 3
我怎樣才能做到這一點?