Error While Executing Query No Such Column
Contents |
Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Error while executing query: no such column: t1.*B.Switch-Tower-Sector I was wondering if no such column sqlite android anyone could let me know where I am going wrong. I am getting sqliteexception no such column android the error... "Error while executing query: no such column: t1.*B.Switch-Tower-Sector" but, the column, t1.[*B.Switch-Tower-Sector], does exist. I get results
No Such Column Sqlite Insert
when I do select[*B.Switch-Tower-Sector] from t1; but an error when I do the UPDATE statement... UPDATE t2 SET [*B.ANT_ORIENTATION] = (SELECT t2.ANT_ORIENTATION FROM t2 WHERE t2.[*SSID-CELLID-SECTOR] = t1.[*B.Switch-Tower-Sector]); Any help would
No Such Column Error In Android
be much appreciated. thanks mike Simon Slavin-3 Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error while executing query: no such column: t1.*B.Switch-Tower-Sector On 8 Jan 2015, at 11:12pm, MikeSnow <[hidden email]> wrote: > UPDATE t2 > SET [*B.ANT_ORIENTATION] = > (SELECT t2.ANT_ORIENTATION > FROM t2 > WHERE > t2.[*SSID-CELLID-SECTOR] = t1.[*B.Switch-Tower-Sector]); no such column sqlite3 You do not mention a specific row of t1, so it doesn't know what value you're talking about. Simon. _______________________________________________ sqlite-users mailing list [hidden email] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users Igor Tandetnik-2 Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error while executing query: no such column: t1.*B.Switch-Tower-Sector In reply to this post by MikeSnow On 1/8/2015 6:12 PM, MikeSnow wrote: > "Error while executing query: no such column: t1.*B.Switch-Tower-Sector" > but, the column, t1.[*B.Switch-Tower-Sector], does exist. I get results > when I do > select[*B.Switch-Tower-Sector] from t1; > but an error when I do the UPDATE statement... > > UPDATE t2 > SET [*B.ANT_ORIENTATION] = > (SELECT t2.ANT_ORIENTATION > FROM t2 > WHERE > t2.[*SSID-CELLID-SECTOR] = t1.[*B.Switch-Tower-Sector]); Before you can use a table name elsewhere, you must introduce it in a FROM clause (or INSERT INTO, UPDATE or DELETE clause). -- Igor Tandetnik _______________________________________________ sqlite-users mailing list [hidden email] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users R Smith Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Error while executing query: no such co
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Android.database.sqlite.sqliteexception No Such Column (code 1)
of this site About Us Learn more about Stack Overflow the company sqlite select no such column Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges no such column django Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://sqlite.1065341.n5.nabble.com/Error-while-executing-query-no-such-column-t1-B-Switch-Tower-Sector-td79905.html minute: Sign up SQLiteException: no such column: category, but column does exist up vote 0 down vote favorite I'm creating an Android project and I have a "DBFunc" class that has multiple methods to handles queries called by the activities. DBFunc.java public int getTotalNumberOfQuestions (String table, String category) { String selectQuery = "SELECT COUNT(*) FROM " + table + " WHERE category='" http://stackoverflow.com/questions/35609672/sqliteexception-no-such-column-category-but-column-does-exist + category + "'"; // example // SELECT COUNT(*) FROM questions WHERE category='History'; SQLiteDatabase database = this.getReadableDatabase(); Cursor c = database.rawQuery(selectQuery, null); int ans = -1; // returns -1 if query unsuccessful if (c.moveToFirst()) { ans = c.getInt(0); } database.close(); c.close(); return ans; } I'm getting an error on the cursor, saying android.database.sqlite.SQLiteException: no such column: category (code 1): , while compiling: SELECT COUNT(*) FROM questions WHERE category='Physics' but I do have a category column in my questions table When running this query through sqlite3 on the command prompt, it works and returns a number (e.g 1) Here's what the schema looks like in "DB Browser for SQLite" I really hope there's an easy solution, because I don't understand why it wouldn't work, Thanks EDIT 1: @CL asked for the code that creates the database. The database is created in sqlite3 command line and passed into the program. But the query I used was CREATE TABLE questions (questionId INTEGER PRIMARY KEY AUTOINCREMENT, question TEXT, option1 TEXT, option2 TEXT, option3 TEXT, option4 TEXT, category TEXT); EDIT 2: I did what @Uwe Partzsch sugested and
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/8682398/sqlite-says-no-such-column-rowid-when-using-sub-queries more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQLite says “no such column: rowid” when using sub-queries up vote 2 down vote favorite 1 Here's a query that works fine: SELECT rowid as msg_rowid, no such a, b, c FROM messages m1 And here's another one that's also fine: SELECT rowid as match_rowid FROM messages m2 WHERE x LIKE '%abc%' But if I put them together as follows, SQLite complains: SELECT rowid as msg_rowid, a, b, c FROM messages m1 JOIN (SELECT rowid as match_rowid FROM messages m2 WHERE x LIKE '%abc%') ON msg_rowid >= match_rowid - 10 AND msg_rowid <= match_rowid + 5 giving what looks like a misleading error message: no such column No such column: rowid. How can I fix this? The query runs fine if I use a messages.timestamp field instead of rowid: SELECT timestamp as msg_ts, a, b, c FROM messages m1 JOIN (SELECT timestamp as match_ts FROM messages m2 WHERE x LIKE '%abc%') ON msg_ts >= match_ts - 10 AND msg_ts <= match_ts + 5 Is this a bug, or a by-design restriction on the use of rowid? sqlite sqlite3 share|improve this question asked Dec 30 '11 at 17:57 romkyns 26.4k16142229 1 Can you try to alias the rowid in the subquery? Like this : SELECT m2.rowid as match_rowid FROM messages m2 WHERE x LIKE '%abc%' –GuZzie Dec 30 '11 at 18:13 1 @GuZzie Whoa... aliasing it in the subquery does not help, but aliasing just the outer one, as m1.rowid, fixes it! –romkyns Dec 30 '11 at 18:27 great! :D glad to hear you fixes the problem –GuZzie Jan 1 '12 at 19:33 add a comment| 1 Answer 1 active oldest votes up vote 5 down vote accepted Answered by GuZzie in a comment. For some reason SQLite requires me to be explicit about the outer rowid: SELECT m1.rowid as msg_rowid, a, b, c FROM messages m1 ^^ HERE JOIN (SELECT rowid as match_rowid FROM messages m2 WHERE x LIKE '%abc%') ON msg_rowid >= match_rowid - 10 AND msg_rowid <=