Sorry, clicked the send button too quickly.

PersonTable
+------------------+
| id         | name |
+------------------+
| 4          | john   |
| 5          | taylor |
+---------+-------+

On 5/21/14, fantasia dosa <fantasia.d...@gmail.com> wrote:
> Thank you for your replies.
>
> I'm sorry for not being super clear about the problem:
>
> Note: The parId belongs to another table not shown here.
>
> TeamTable
> +---------------------------------+
> | id         | parId | personIds |
> +---------------------------------+
> | 1          | 4       | 1,5,2,3,4   |
> | 2          | 5       | 2,6,3,5,1   |
> +----------------------------------|
>
> PersonTable
> +------------------+
> | id         | name |
> +------------------+
> | 4          | 4       |
> | 5          | 5       |
> +---------+-------+
>
> @Simon, thank you for showing me a better way to setup the tables,
> your way makes much more sense,  only problem is that in this
> situation, the tables have already been defined and made by someone
> else so I cannot change it.  I'm a bit stuck with the way it is.
>
> @ Gunter, the picture above is a better representation of the tables.
>
> After searching on the net for an answer, I think what I want is a way
> to get a subSelect statement to return something  that the Select from
> IN (string) can work.  At least this is what I'm thinking from my very
> very limited understanding of SQL and with the way that I'm trying to
> do this.
>
>
>
>
> On 5/21/14, Hick Gunter [via SQLite]
> <ml-node+s1065341n7575...@n5.nabble.com> wrote:
>>
>>
>> You show a field parId in your TeamTable, but select it from the
>> PersonTable. Maybe you mean
>>
>> SELECT * FROM PersonTable WHERE id IN (SELECT personIDs FROM TeamTable
>> WHERE
>> parId = 4);
>>
>> -----Ursprüngliche Nachricht-----
>> Von: fantasia dosa [mailto:fantasia.d...@gmail.com]
>> Gesendet: Mittwoch, 21. Mai 2014 15:00
>> An: sqlite-users@sqlite.org
>> Betreff: [sqlite] Simple Select from IN - from a newbie.
>>
>> Hi all wonderful people on this list.
>>
>> I'm a newbilie so my questions might seem very well-- kinda dumb so
>> please
>> forgive me.
>>
>> I'm trying to do the following in Sqlite.
>>
>> TeamTable -
>>     parId: 4
>>     personIDs :  1,5,9,6
>>
>> PersonTable -
>>    id:
>>    name:
>>
>> SELECT * FROM PersonTable WHERE id IN (SELECT personIDs FROM PersonTable
>> WHERE parId = 4);
>>
>> The result from the above query is empty whereas when I do:
>> SELECT * FROM PersonTable WHERE id IN(1,5,9,6)
>>
>> Then I get the result that I need.
>>
>> Any help is greatly appreciated.
>>
>> Cheers.
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> 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: h...@scigames.at
>>
>> 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
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>>
>> _______________________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://sqlite.1065341.n5.nabble.com/Simple-Select-from-IN-from-a-newbie-tp75751p75753.html
>>
>> To unsubscribe from Simple Select from IN - from a newbie., visit
>> http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=75751&code=ZmFudGFzaWEuZG9zYUBnbWFpbC5jb218NzU3NTF8MTk4Njk4NTgwNw==
>




--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/Simple-Select-from-IN-from-a-newbie-tp75751p75755.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to