On 06-07-2011 17:30, e-mail mgbg25171 wrote:
>                                 1990        1991  year   <===== dimension
> 
> north         sales        10            8
>                 cogs         (5)           (4)
> south        sales         6             5
>                 cogs         (2)           (1)
> 
> region        line item   <==========  dimensions
> 
> I just want to be able to specify different dimensional values and get back
> rectangles of data that I can manipulate. I've already done the manipulation
> stuff so it's just how to layout the data.
> Query examples would be...
> 
> total = north + south                             returning 9, 8

select data from <table> where region in ('north','south')

> total cogs = north.cogs + south.cogs     returning -7, -5

select data from <table> where category = 'cogs'
( 'sales', and 'cogs' are in the dimension 'category')

> 1990                                                   returning 10,-5,6,-2

select data from <table> where year=1990

> north:1991                                           returning 8,-4

select data from <table> where region='north' and year=1991

> north:1990..1991                                  returning 10,8

select data from <table> where region='north' and year between 1990 an d
1991

> 
> Once you've created region I don't think you can delete it and all it's
> entries cos that would delete everything i.e. I believe you have to leave at
> least one value in the column whether it be null or north.
> 


I looks like pivot table, like Roger calls them
but that is layout, and has nothing much to do with SQL


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

Reply via email to