In my membership database, I have a 'people' table and a 'userviews' table.
This second table consists of a (name,sql) pair.
What it does is allow my users to load a particular list of people from the
people table. So for example, ('LA','where city like "LA"') might be the
entry for a "view" called "LA".
But now the users want to view a list of *specific* people, e.g. by people.id.
In the UI for my db, they can click on people and 'tag' them, and there is a
corresponding people.tagged field. They can do various operations on the
tagged list of people. Right now, they want to generate a 'userview' of just
the tagged people -- but since we can't keep those people tagged forever, they
need a userview.sql more complicated than 'where tagged=1'.
What I am looking for is a SQL way to do the query:
select id from people where tagged=1;
and instead of
1
2
6
34
get 1,2,6,34
Because what I ultimately want to do is a statement like:
insert into userviews values ('coolview', 'where id in (1,2,6,34)');
But I don't see any way to generate this insert statement from the prior
select. Any ideas?
Thanks!
--
My GPG public key is at http://ronware.org/
fingerprint: 8130 734C 69A3 6542 0853 CB42 3ECF 9259 AD29 415D