How to find the data of the respective month

0

I'd like to know how to get only the data for the month we're in.

For example: I have the date 2017-05-10 and I have the date 2017-11-05 , as I do to get the data only from a date with MySQL. I only want the date data 2017-11-05 , so it returns me all the data that is on that date, how can I do this?

What I have so far:

mysqli_query($sql, "SELECT data, sum(total) FROM pedidos";
    
asked by anonymous 17.11.2017 / 12:55

2 answers

0

I think that's what you're looking for:

mysqli_query($sql,"SELECT data, sum(total) FROM pedidos WHERE date like '%" . date("Y-m") . "%'");
    
17.11.2017 / 12:57
0

Do this:

mysqli_query($sql, "SELECT data, sum(total) FROM pedidos where data >=" . date('Y-m');

    
17.11.2017 / 12:58