Use single quotes instead of double


sqlite> select (select v from t1 where n='a') wrong,*  from a1;
wrong|a|b
2000|123|456
2000|999|999



Michael D. Black

Senior Scientist

NG Information Systems

Advanced Analytics Directorate



________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of thilo [th...@nispuk.com]
Sent: Tuesday, June 28, 2011 1:42 PM
To: General Discussion of SQLite Database
Subject: EXT :[sqlite] Is this a BUG or am I wrong ? sub-select returns nothing 
when column id matches the inner query

Hello there!

I found a strange behavior while doing a
select with a sub select that has a where clause with a value (here
'a') which is the same as a column id:

What am I missing here ?


SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .mode column
sqlite> .header on

sqlite> select (select v from t1 where n="a") wrong,*  from a1;

wrong       a           b
----------  ----------  ----------
            123         456
            999         999
sqlite>
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE a1 (a int,b int);
INSERT INTO "a1" VALUES(123,456);
INSERT INTO "a1" VALUES(999,999);
CREATE TABLE "t1" (n text primary key on conflict replace,v integer);
INSERT INTO "t1" VALUES('good',1000);
INSERT INTO "t1" VALUES('a',2000);
COMMIT;
sqlite>

Any light to the problem (especially if it is already fixed) is very
much appreciated.

My OS is NetBSD,

cheers thilo


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to