Re: [sqlite] View with Dynamic Fields ?

2008-07-09 Thread Andrea Connell
. It's not a big deal - I was just wondering if a simpler solution was available. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicolas Williams Sent: Wednesday, July 09, 2008 2:41 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] View

Re: [sqlite] View with Dynamic Fields ?

2008-07-09 Thread Nicolas Williams
On Wed, Jul 09, 2008 at 12:32:27PM -0700, Andrea Connell wrote: > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote > > > > Andrea Connell wrote: > > > I am still holding a shred of hope for a trigger that can recreate the > > > view whenever the questions table is

Re: [sqlite] View with Dynamic Fields ?

2008-07-09 Thread Andrea Connell
Of Dennis Cote Sent: Tuesday, July 08, 2008 5:08 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] View with Dynamic Fields ? Andrea Connell wrote: > > I am still holding a shred of hope for a trigger that can recreate the > view whenever the questions table is modif

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Dennis Cote
Andrea Connell wrote: > > I am still holding a shred of hope for a trigger that can > recreate the view whenever the questions table is modified > I wouldn't hold much hope for that. Triggers can only execute insert, update, delete, or select SQL statements. There is no way to execute a

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Harold Wood
if sqlite supported the pivot command   Woody --- On Tue, 7/8/08, Andrea Connell <[EMAIL PROTECTED]> wrote: From: Andrea Connell <[EMAIL PROTECTED]> Subject: Re: [sqlite] View with Dynamic Fields ? To: "General Discussion of SQLite Database" <sqlite-users@sqlite.o

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Igor Tandetnik
Andrea Connell <[EMAIL PROTECTED]> wrote: > Here is the view I have come up with so far, which would require > editing whenever an insert or delete is done on tblQuestions. > > CREATE VIEW allanswers as > SELECT applicantid, > (select answer from tblanswers Z where questionid = 1 and

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Nicolas Williams
On Tue, Jul 08, 2008 at 09:09:05AM -0700, Andrea Connell wrote: > I'm not sure if what I want is possible to do in SQL, but I -am- sure > that one of you will know. > Given two tables - one with questions to ask applicants and one with an > applicant's answer to a particular question - I want to

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Andrea Connell
anks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, July 08, 2008 1:21 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] View with Dynamic Fields ? This gives the same result set you got and does not

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread cmartin
This gives the same result set you got and does not need to be edited: select applicantid, group_concat(answer, '|') from (select applicantid, answer from tblanswers order by questionid) group by applicantid; The group_concat() function is part of recent versions of SQLite. It

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Dennis Cote
Andrea Connell wrote: > > I want one row with all answers for an applicant, and I want it to work > for an arbitrary number of rows in tblQuestions or be able to update > itself on an insert or delete. Any ideas? > If you want each answer in it's own column, I don't think it can be done

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Andrea Connell
Harold Wood wrote: >my approah would be a table for applicants, then the table for answers would have the applicantid and the questionid as well as the answer. > >CREATE TABLE tblApplicants (applicantid int, applicantname varchar(100)); >now just do a select joining the tables > >select

Re: [sqlite] View with Dynamic Fields ?

2008-07-08 Thread Harold Wood
asc, qu.questionid asc   --- On Tue, 7/8/08, Andrea Connell <[EMAIL PROTECTED]> wrote: From: Andrea Connell <[EMAIL PROTECTED]> Subject: [sqlite] View with Dynamic Fields ? To: sqlite-users@sqlite.org Date: Tuesday, July 8, 2008, 12:09 PM I'm not sure if what I want is possible

[sqlite] View with Dynamic Fields ?

2008-07-08 Thread Andrea Connell
I'm not sure if what I want is possible to do in SQL, but I -am- sure that one of you will know. Given two tables - one with questions to ask applicants and one with an applicant's answer to a particular question - I want to make a flattened view with all of an applicant's answers in one row.