SQLIte some helpfull Queries


1. SQL query for sort by date from current date
    program_detail is string field in table and storing as "YYYY-MM-dd"
    SELECT * FROM program_detail WHERE program_date>'2014-06-10' ORDER BY program_date
  
    Second method using "DATE('now')" function    
    SELECT * FROM program_detail WHERE program_date>DATE('now') ORDER BY program_date

2. SQL query for sort by date and only data of perticular year and month
    program_detail is string field in table and storing as "YYYY-MM-dd"
    "strftime" is date function which support string type
    SELECT * FROM program_detail WHERE strftime('%Y-%m', program_date) = '2014-06' ORDER BY program_date

Comments

Popular Posts