mysql - In SQL date function for before 2 months -
i mentioned database table structure below,
name, expired_date, address, payment_date ---------------------- name1, 2013/06/02, address1,2013/07/23 name2, 2013/06/02, address2,2013/07/23 name3, 2013/04/02, address3,2013/07/23 name4, 2013/05/02, address4,2013/07/23 name5, 2013/06/02, address5,2013/07/24 ... name6, 2013/06/02, address6,.....
in table update date in yyyy/mm/dd
format . current month april need after 2 records only. example need 06 month records only.
i need sql query this.
assuming want query expired_date:
following query gets records after 2 months current date:
select * tablename expired_date>=date_add(curdate(), interval 1 month)
if want records june:
select * tablename expired_date>='2013-06-01' , expired_date<'2013-07-01'
Comments
Post a Comment