我正在尝试将以下SQL语句转换为DBFlow方法调用:
SELECT t.SSID, t.BSSID, t.Latitude, t.Longitude, t.Timestamp
FROM wlan_events t
INNER JOIN (SELECT BSSID, MAX(Timestamp) AS MaxTimestamp FROM wlan_events GROUP BY BSSID) groupedt
ON t.BSSID = groupedt.BSSID AND t.Timestamp = groupedt.MaxTimestamp
到目前为止我得到了什么:
SQLite.select(WifiEvent_Table.SSID, WifiEvent_Table.BSSID, WifiEvent_Table.latitude,
WifiEvent_Table.longitude)
.from(WifiEvent.class)
.as("t")
.innerJoin(WifiEvent.class) // ????
如何使用dbflow创建内连接的select语句?
答案 0 :(得分:0)
这是我发现的:
SELECT EMP_ID, NAME, DEPT FROM COMPANY LEFT OUTER JOIN DEPARTMENT
ON COMPANY.ID = DEPARTMENT.EMP_ID
DBFlow中的:
SQLite.select(Company_Table.EMP_ID, Company_Table.DEPT)
.from(Company.class)
.leftOuterJoin(Department.class)
.on(Company_Table.ID.withTable().eq(Department_Table.EMP_ID.withTable()))
.queryList();
希望这会有所帮助:(链接更新)