I'm relatively newbie too, but just curious, is it anything to do with (select id from tbl2 where name="Joe") not being guarenteed to return a scaler?
Ie only a single value? -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dermot Sent: 18 March 2009 15:47 To: General Discussion of SQLite Database Subject: Re: [sqlite] Newbie question 2009/3/18 Igor Tandetnik <itandet...@mvps.org>: > Dermot <paik...@googlemail.com> wrote: >> I want to do a select query a bit like this: >> >> SELECT * FROM tbl1 WHERE description="someval" AND >> foreign_key_id=(select id from tbl2 where name="Joe"); >> >> This gives me a syntax error and my other efforts are not yielding >> results. > > What's the text of the error message? SELECT * FROM tbl1 WHERE description="someval" AND foreign_key_id=(select id from tbl2 where name="Joe"); This attempt give the error: SQL error: near "=": syntax error SELECT * FROM tbl1 WHERE description="someval" AND foreign_key_id='select id from tbl2 where name="Joe"'; This return nothing, although it should. If I break the queries into 2 separate select statements they verify. This is SQLite 3.5.1. Thanx, Dp. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users