Use IN

Projid = (SELECT ...) takes only the first value returned from the subselect

-----Ursprüngliche Nachricht-----
Von: jose isaias cabrera [mailto:[email protected]]
Gesendet: Donnerstag, 23. Jänner 2014 20:11
An: General Discussion of SQLite Database
Betreff: [sqlite] SELECTing from another SELECT


Greetings!

I have these tables A and B:
A
id,projid,a,b
1,1,'a','h'
2,2,'b','i'
3,3,'c','j'
4,4,'d','k'
5,5,'e','l'
...
...


B
id,projid,ptask
101,1,'a'
102,2,'b'
103,3,'a'
104,4,'b'
105,5,'a'
...
...

When I do this SELECT,

SELECT * FROM A WHERE projid = (SELECT projid FROM B WHERE ptask = 'a');

This only returns one record (record 1) where it should return all the records 
with ptask = 'a'.  Will someone point me to the right syntax to get this 
correct?  Thanks for the help.

josé

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


--------------------------------------------------------------------------
 Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: [email protected]

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any person as to do so could be a breach of confidence. Thank you 
for your cooperation.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to