SQLite 数据库 select 从多个表查询 windows phone

SQLite database select query from multiple tables for windows phone

正在尝试开发一个 Windows phone 8.0 存储 App.I 需要从一个有两个 table 的 sqlite 数据库中检索记录,到目前为止我还没有找到它的任何教程。这是我正在做的从一个 table

获取数据
var retrievedTasks = dbConn.Query<MMain>("SELECT MMain.ID,           MMain.Name, health.age
FROM MMain INNER JOIN health ON MMain.key = health.key
where MMain.ID = 1" ).FirstOrDefault();  

但我想实现这个以从两个 tables

获取数据
       foreach (var rr in retrievedTasks)
        { 

         //how to fetch data from health class table 
        } 

那么如何做到这一点以及如何从中获取数据

您的查询看起来有误(一个额外的逗号,您应该使用 INNER 加入相关的 ON 子句)

SELECT MMain.ID, MMain.Name, health.age
FROM MMain INNER JOIN health ON MMain.key = health.key
where MMain.ID = 1

除此之外,我没有看到 pb。