On Tue, 12 Jan 2010 16:12:01 -0500, Qianqian Fang
<fan...@gmail.com> wrote:

>On 1/12/2010 4:08 PM, Jay A. Kreibich wrote:
>> SELECT group_concat( value ) FROM mydata WHERE id IN ( 'id_1', 'id_2', ... )
>>    
>
>hi Jay
>
>thank you very much for your quick response. I guess this will be
>significantly faster than looping through each id.

It isn't faster than getting the same information with
SELECT value FROM mydata
 WHERE id IN ('id_1','id_2',...,'id_N');
This returns:
value1
value2
:
valueN

whereas
SELECT group_concat(value) FROM mydata
 WHERE id IN ('id_1','id_2',...,'id_N')
returns:
value1,value2,...valueN


But you're right, it is certainly faster than

for i=1;i <= N; i++){ 
        "select value from mydata where id='id_$i'"
}

>One more question, will this work if you have a long list of ids (say
>a few hundred)?
>
>thanks
>
>Qianqian

Hope this helps,
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to