2
我的應用程序與sql lite數據庫一起工作我在SQlite開發人員中懷疑查詢並測試它,這是正常工作的,但是當我在android中編寫它時,它只返回一個值爲幾個的值。 Android查詢有什麼不對?程序我的查詢工作不正確
代碼
SELECT DISTINCT
m._id,
m.name,
m.the_best_time,
m.the_worse_time,
count(p._id) as qPoints
FROM sickness AS s
INNER JOIN list_of_sicknesses AS l
ON s._id = l.sickness_id
INNER JOIN point AS p
ON p.sickness_list = l.number
INNER JOIN meridian AS m
ON m._id = p.meridian_id
WHERE s.sick = 'value'
GROUP BY
m.name,
m.the_best_time,
m.the_worse_time,m._id
代碼的Android查詢
String query="select distinct m." +MeridianDB.ID+
",m."+MeridianDB.NAME+",m."+MeridianDB.BEST_TIME+
",m."+MeridianDB.WORSE_TIME+",count(p."+PointDB.ID+") as qPoints from "+
SicknessDB.TABLE_NAME+" as s inner join "+ListOFSicknessDB.TABLE_NAME+
" as l on s."+SicknessDB.ID+" = l."+ListOFSicknessDB.SICKNESS_ID+
" inner join "+PointDB.TABLE_NAME+" as p on p."+PointDB.SICKNESS_LIST+
" = l."+ListOFSicknessDB.NUMBER+" inner join "+MeridianDB.TABLE_NAME+
" as m on m."+MeridianDB.ID+" = p."+PointDB.MERIDIAN_ID+" where s."+
SicknessDB.NAME+"=? group by m."+MeridianDB.ID+",m."+MeridianDB.NAME+
",m."+MeridianDB.BEST_TIME+",m."+MeridianDB.WORSE_TIME;
您是否v驗證android代碼中的實際查詢是否與上面提到的sqlite查詢匹配? – PCoder
它們是相同的除了「where s。」+ SicknessDB.NAME +「=? – Abbath
不是真的。android查詢最後GROUP BY'm._id' – mvp