Andy,

You should be looking for pivot tables. However, there is no native support
for them in sqlite as far as I know. Some databases (e.g. SQL Server 2005+)
know PIVOT command but not sqlite.

You may want to look at
http://mesh.dl.sourceforge.net/sourceforge/souptonuts/Solving_Complex_SQL_Problems.txtor
construct them in the application layer as I do.

Good luck,
Tomas


On Thu, Sep 4, 2008 at 1:09 PM, Andy Chambers <[EMAIL PROTECTED]
> wrote:

> Hi,
>
> I have a table like this
>
> create table clinical_data (
>  group_def text,
>  item_def text,
>  value text
> );
>
> Assuming this example data...
>
> GROUP_DEF, ITEM_DEF, VALUE
> ---------------------------------------------------
> "MEDHIST", "BODSYS",  "foo"
> "MEDHIST", "TERM", "bar"
> "MEDHIST", "ONSET", "baz"
>
> I'd like to create a view that looks like
>
> BODSYS, TERM, ONSET
> ---------------------------------------
> "foo", "bar", "baz"
>
> I've got a feeling the answer lies in outer joins but my SQL is a
> little rusty.  This seems like something people would need to do a
> lot.  Is there a name for this that I can go lookup?
>
> Many Thanks,
> Andy
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to