I think it is not possible. You can't express an arbitrary loop with SQL. Perhaps you could write a group-by user function doing this, I am not sure, but user functions are again C code.

Jakub

Keith Herold wrote:
I have a semi-quick question about how to do successive string concatenation.

I have a table:

CREATE TABLE mystrings
(
   OwnerID INTEGER NOT NULL,
   AString VARCHAR(900),
   Sequence INTEGER DEFAULT 0
);

Each AString is associated with an Owner; a single owner can have
multiple strings assigned to it, with the order of the strings held by
sequence:

OwnerID, AString, Sequence
1,  'concatenate', 0
1, 'some', 1
1, 'strings', 2
1, 'together', 3

What I need to do is create a single string out of the AString,
Sequence pairs, for a given owner. Obviously I could do this through
some C++ code, but I would prefer to do it within SQL code, but can't
think of a way.  The sequences are not always the same lenght, i.e., a
particular owner may have 1, 10, or 1972 word long sequences.  With
cursors, I don't think this would be difficult, but I can't figure out
how to do this within SQLite.

Any help?

--Keith

--

Jakub Adamek
Programmer
Telematix Software, a.s.
Karoliny Svetle 12, Praha 1
http://www.telematix.cz
Tel: +420 608 247197
Office: +420 224233470

Reply via email to