SQLite

SQLite 今月の全件データを取得する SQL 文

2014年9月7日

今月の合計を取得したくて調べました。

BuyList テーブルの Date 列データが今月のリストを表示する SQL 文です。

'今月の全件データを表示
select * from BuyList where Date between date ('now', 'start of month') and date ('now', 'start of month', '+1 month', '-1 day')

'今月の集計データは SUM 関数を組み合わせて取得
select SUM(Date) from BuyList where Date between date ('now', 'start of month') and date ('now', 'start of month', '+1 month', '-1 day')

参考ページ
the sqlite common sql statement
http://www.databaseskill.com/1046790/

-SQLite