ich mit dieser Abfrage stucked haben:Android: SQLiteException: keine solche Spalte, wenn ich Unterabfragen verwenden
SELECT * FROM (
SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM mushrooms tab
JOIN mushrooms_pics pics ON t_id = pics.id WHERE t_id IN
(SELECT item_id FROM coordinate WHERE type = "mushrooms") UNION
SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM berries tab
JOIN berries_pics pics ON t_id = pics.id WHERE t_id IN
(SELECT item_id from coordinate WHERE type = "berries") UNION
SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM herbs tab
JOIN herbs_pics pics ON t_id = pics.id WHERE t_id IN
(SELECT item_id from coordinate WHERE type = "herbs")
)
LEFT JOIN coordinate c ON t_id = c.item_id WHERE t_id IN
(SELECT item_id from coordinate)
Die Abfrage funktioniert in "DB-Browser für SQLite" in Ordnung, aber in meiner app bekomme ich einen Fehler, Hier ist der Fehler in LOGCAT:
android.database.sqlite.SQLiteException: no such column: herbs (code 1): , while compiling: SELECT name FROM(SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM mushrooms tab JOIN mushrooms_pics pics ON t_id = pics.id WHERE t_id in (SELECT item_id from coordinate WHERE type = mushrooms) UNION SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM berries tab JOIN berries_pics pics ON t_id = pics.id WHERE t_id in (SELECT item_id from coordinate WHERE type = berries) UNION SELECT tab._id t_id, tab.name name, pics.pic1 pic FROM herbs tab JOIN herbs_pics pics ON t_id = pics.id WHERE t_id in (SELECT item_id from coordinate WHERE type = herbs)) LEFT JOIN coordinate c on t_id = c.item_id WHERE t_id in (SELECT item_id from coordinate)
Gibt es irgendwelche Ideen, wie kann ich das beheben? Danke;)
Vielen Dank, es hat geholfen! – Nemesis