DBFlow - 与另一个select语句的内连接

时间:2015-12-30 15:11:48

标签: android sql sqlite dbflow

我正在尝试将以下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语句?

1 个答案:

答案 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();

希望这会有所帮助:(链接更新)

https://agrosner.gitbooks.io/dbflow/content/