android - How to query a table by retrieving priority data and sort by order in SQLITE DB -
i stuck retrieve query. have table called "history" table have fields , info like, example...
display_date | item_type2014-10-05 | 0
2014-10-08 | 0
2014-10-07 | 1
2014-10-09 | 1
2014-11-05 | 0
2014-11-05 | 1
i retrieve 1 month info history table , order display_date. , sort item_type field 0 1 if display_date same. query statement select * history strftime('%y-%m-%d',display_date)>=strftime('%y-%m-%d','now') , strftime('%y-%m-%d',display_date)<=date('now', '+1 month') order display_date desc;
query give me sorted display_date.
but retrieve 1 month info history table , order display_date. , sort item_type field 0 1 if display_date same.
display_date | item_type2014-10-05 | 0
2014-10-05 | 1
2014-10-07 | 1
2014-10-08 | 0
2014-10-09 | 1
2014-11-05 | 1
2014-11-05 | 0
please help me figure out. give thanks you.
use query:
select * history display_date between date('now') , date('now', '+1 month') order display_date, item_type
sqlfiddle demo.
android sqlite
No comments:
Post a Comment