Nico, thanks a lot! This is awesome.

create view today_dow as
select monday_goal from user_goals
union
select tuesday_goal from user_goals
union
select wednesday_goal from user_goals
union
select thursday_goal from user_goals
union
select friday_goal from user_goals
union
select saturday_goal from user_goals
union
select sunday_goal from user_goals;




> Nico Williams writes:
> > On May 11, 2011 7:14 PM, "John" <[email protected]> wrote:
> > > let's say I have a table with columns for each day of the week
> > >
> > > create table seven_days
> > > (monday_value integer,
> > >  tueday_value integer,
> > >  wednesday_value integer,
> > >  ...   );
> > >
> > > I want to select value from whatever day it is today. So if today is
> > > Tuesday, select from tuesday_value.
> > >
> > > Can I do it with pure SQlite?
> >
> > Sure.  First setup a view that consists of a union of queries one for
> each
> > day, with a column whose value is the day of the week.  Then query that
> > view.
> >
> > Nico
> > --
> > _______________________________________________
> > sqlite-users mailing list
> > [email protected]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
~John
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to