On 7-aug-2011, om 13:17, Alexey Pechnikov wrote:

> Is it possible to support construction like to
>
> where x IN "1 2 3"
>
> There are a lot of situations when is very useful to store list of
> identifiers in table field.
> I know about the intarray virtual table but it's need
> constructor/destructor calls (and
> produce segfaults with the autorizer function).
>
> Does somebody interesting in this functionality too?
>
> --  
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/

Hello,

I would be interested in this functionality too, or more generalized  
in an inverse function for group_concat. Earlier, group_split was  
proposed. For SQLite I imagine this to become a virtual table. I  
created one, through APSW, with the following schema:

     group_split (line, words)

(when I use .schema group_split in the APSW shell, it  only display  
the module name)

The dialog below shows its usage. I'm not completely happy about it  
yet. The predefined column names (line and words) seem artificial. It  
lacks the option to specify a seperator character. I imagine a third  
column but that will meke the definition of the filter much more  
difficult. A built-in soultion would be welcome.

Best regards,  Edzard Pasma.

     SQLite version 3.7.7.1 (APSW 3.7.7.1-r1)
     Enter ".help" for instructions
     Enter SQL statements terminated with a ";"
     sqlite> .schema group_split
     CREATE VIRTUAL TABLE group_split USING mymod();
     sqlite> create table t1 (grp, elem);
     sqlite> insert into t1 values ('g1', 'aap');
     sqlite> insert into t1 values ('g1', 'noot');
     sqlite> insert into t1 values ('g1', 'mies');
     sqlite> insert into t1 values ('g2', 'wim');
     sqlite> insert into t1 values ('g2', 'zus');
     sqlite> insert into t1 values ('g2', 'jet');
     sqlite> select grp, group_concat (elem) from t1 group by grp;
     g1|aap,noot,mies
     g2|wim,zus,jet
     sqlite> select grp, word
     from (select grp, group_concat (elem) elems from t1 group by grp)
     join group_split on line = elems;
     g1|aap
     g1|noot
     g1|mies
     g2|wim
     g2|zus
     g2|jet

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

Reply via email to