'.', <column alias name>, <compound operator>, AS, BETWEEN, FROM, GROUP, IN, LIMIT, ORDER, WHERE, comma or semicolon expected, got 'SELECT'
'.', <column alias name>, <compound operator>, AS, BETWEEN, FROM, GROUP, IN, LIMIT, ORDER, WHERE, comma or semicolon expected, got 'SELECT'
我需要帮助修复标题 _ 上面的错误出现在这个查询的 FROM 之后的第一个 SELECT 中,欢迎所有建议,非常感谢。
public ArrayList<HashMap<String, String>> getAll_Datas() {
ArrayList<HashMap<String, String>> arrayListAllData = new
ArrayList<HashMap<String, String>>();
SQLiteDatabase database = this.getWritableDatabase();
Cursor cursor = database.rawQuery
(
" SELECT lespontes.idPontes ,\n" +
" lespontes.Cage as Cage,\n" +
" lespontes.Couvés,\n" +
" dbfécondation.Fécondés " + "FROM " +
(
" SELECT idPontes FROM lespontes"+
" UNION "
+ " SELECT idPontes FROM dbfécondation" ) +
" LEFT OUTER JOIN"
+ " lespontes USING (idPontes)"+
" LEFT OUTER JOIN "
+ " dbfécondation USING (idPontes)"+
" Order By " + " lespontes.Cage " + " ASC ",null);
if (cursor.moveToFirst()) {
do {
HashMap<String, String> hashMapData= new HashMap<String,
String>();
hashMapData.put("idPontes", cursor.getString(0));
hashMapData.put("Cage",cursor.getString(1));
hashMapData.put("Couvés",cursor.getString(2));
hashMapData.put("Fécondés", cursor.getString(3));
arrayListAllData.add(hashMapData);
} while (cursor.moveToNext());
}
return arrayListAllData;
}
尝试使用:-
Cursor cursor = database.rawQuery
(
" SELECT lespontes.idPontes ," +
" lespontes.Cage as Cage," +
" lespontes.Couvés," +
" dbfécondation.Fécondés " + "FROM (" +
" SELECT idPontes FROM lespontes" +
" UNION "
+ " SELECT idPontes FROM dbfécondation)" +
" LEFT OUTER JOIN"
+ " lespontes USING (idPontes)" +
" LEFT OUTER JOIN "
+ " dbfécondation USING (idPontes)" +
" Order By " + " lespontes.Cage " + " ASC ", null);
即SELECT 周围的括号已嵌入 SQL 中。此外,无用的换行符 (\n
's) 也已被删除。
我需要帮助修复标题 _ 上面的错误出现在这个查询的 FROM 之后的第一个 SELECT 中,欢迎所有建议,非常感谢。
public ArrayList<HashMap<String, String>> getAll_Datas() {
ArrayList<HashMap<String, String>> arrayListAllData = new
ArrayList<HashMap<String, String>>();
SQLiteDatabase database = this.getWritableDatabase();
Cursor cursor = database.rawQuery
(
" SELECT lespontes.idPontes ,\n" +
" lespontes.Cage as Cage,\n" +
" lespontes.Couvés,\n" +
" dbfécondation.Fécondés " + "FROM " +
(
" SELECT idPontes FROM lespontes"+
" UNION "
+ " SELECT idPontes FROM dbfécondation" ) +
" LEFT OUTER JOIN"
+ " lespontes USING (idPontes)"+
" LEFT OUTER JOIN "
+ " dbfécondation USING (idPontes)"+
" Order By " + " lespontes.Cage " + " ASC ",null);
if (cursor.moveToFirst()) {
do {
HashMap<String, String> hashMapData= new HashMap<String,
String>();
hashMapData.put("idPontes", cursor.getString(0));
hashMapData.put("Cage",cursor.getString(1));
hashMapData.put("Couvés",cursor.getString(2));
hashMapData.put("Fécondés", cursor.getString(3));
arrayListAllData.add(hashMapData);
} while (cursor.moveToNext());
}
return arrayListAllData;
}
尝试使用:-
Cursor cursor = database.rawQuery
(
" SELECT lespontes.idPontes ," +
" lespontes.Cage as Cage," +
" lespontes.Couvés," +
" dbfécondation.Fécondés " + "FROM (" +
" SELECT idPontes FROM lespontes" +
" UNION "
+ " SELECT idPontes FROM dbfécondation)" +
" LEFT OUTER JOIN"
+ " lespontes USING (idPontes)" +
" LEFT OUTER JOIN "
+ " dbfécondation USING (idPontes)" +
" Order By " + " lespontes.Cage " + " ASC ", null);
即SELECT 周围的括号已嵌入 SQL 中。此外,无用的换行符 (\n
's) 也已被删除。