jeudi 10 décembre 2015

Subquery Returning Error

I am trying to implement a subquery but am getting an error saying only a single result allowed. Am I implementing it wrong in the query or is the statement itself wrong?

The search should be returning the name of the recipe name that matches the code produced in the nested select statement

Query

    return db.rawQuery("select recipe_name from recipes where recipe_code in (select ingredients.recipe_code, ingredients._id from ingredients inner join kitchen on kitchen.ingredient_name = ingredients.ingredient_name)", null);

Error

 Caused by: android.database.sqlite.SQLiteException: only a single result allowed for a SELECT that is part of an expression (code 1): , while compiling: select recipe_name from recipes where recipe_code in (select ingredients.recipe_code, ingredients._id from ingredients inner join kitchen on kitchen.ingredient_name = ingredients.ingredient_name)

12-10 22:19:04.238 29209-29209/com.example.rory.prototypev2 E/AndroidRuntime: at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)

Aucun commentaire:

Enregistrer un commentaire