Skip to content

Instantly share code, notes, and snippets.

@srockstyle
Created March 12, 2013 22:31
Show Gist options
  • Save srockstyle/5147700 to your computer and use it in GitHub Desktop.
Save srockstyle/5147700 to your computer and use it in GitHub Desktop.
一定期間内のデータを抽出するには以下のSQL。二番目はRailsのcreated_atの場合引っ張ってきたいものを指定したりするのに使う。
SELECT id from table_name where date>=ADDDATE(CURDATE(),Interval -7 DAY)
SELECT `recruits`.* FROM `recruits` WHERE (keisai_flag = '1' and date_add(current_date, interval -3 day) <= created_at )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment