MySQL Query SQL statements today, yesterday, nearly 7 days, nearly 30 days, this month, and last JanuaryThis article mainly introduces the MySQL query today, yesterday, nearly 7 days, nearly 30 days, this month, the January of SQL statements,
Mysql query today, yesterday, last 7 days, last 30 days, this month, the data method of the last month said there is an article table article, storing the time for adding an article to the article is the add_time field, this field is of the int (5)
MySQL Query SQL statements today, yesterday, nearly 7 days, nearly 30 days, this month, and last JanuaryThis article mainly introduces the MySQL query today, yesterday, nearly 7 days, nearly 30 days, this month, the January of SQL statements,
Mysql Query today, yesterday, last 7 days, last 30 days, this month, the last month data method Analysis Summary: No source code and demonstration: demonstrate the source, there is an article table article, the time for adding an article is the
---restore content starts---All data for Today: SELECT * FROM table name where DateDiff (dd,datetime Type field, GETDATE ()) =0All data yesterday: SELECT * from table name where DateDiff (dd,datetime Type field, GETDATE ()) =1All data within 7 days:
MySQL queries data from yesterday, today, 7 days, last 30 days, this month, and last month, and mysqlDuring development or statistics, we may need to count the data of a table. For example, view new articles today and calculate the number of new
MySQL query today, yesterday, nearly 7 days, nearly 30 days, this month, the last month of data method Analysis Summary:There is an article table article, the time to store the article's add-on is the Add_time field, which is of type int (5), and
All data for Today: SELECT * FROM table name where DateDiff (dd,datetime Type field, GETDATE ()) =0All data yesterday: SELECT * from table name where DateDiff (dd,datetime Type field, GETDATE ()) =1All data within 7 days: SELECT * from table name
Records reprinted from: Http://www.cnblogs.com/suruozhong/p/5974595.htmlall data for today: SELECT * FROM table name where DateDiff (dd,datetime Type field, GETDATE ()) =0 all data for yesterday: SELECT * from table name where DateDiff (DD, DateTime
All data for Today: SELECT * FROM table name where DateDiff (dd,datetime Type field, GETDATE ()) =0All data yesterday: SELECT * from table name where DateDiff (dd,datetime Type field, GETDATE ()) =1All data within 7 days: SELECT * from table name
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.