sql - sqlite return as day of week -
i have 1 table has 3 columns:
tb1 = _id(int,prikey,autoinc) , busnum(text) , servdate(date)
i use following query me jobs within past week ( week starts monday):
select * tb1 servdate between date('now', 'weekday 1', '-21 days') , date('now')
i want query work same instead return "servdate" fields corresponding day of week. example, "monday", instead of "2010-11-28".
is possible?
you can use ancillary table wallyk suggested; or can use case
expression:
select _id, busnum, case cast (strftime('%w', servdate) integer) when 0 'sunday' when 1 'monday' when 2 'tuesday' when 3 'wednesday' when 4 'thursday' when 5 'friday' else 'saturday' end servdayofweek tb1 ...
Comments
Post a Comment