How does a column of dates compare to a specific date?

0

In this image on the left side are the tables that give me, on the side right is what he asks me to do and below in blue is the code that I made

in MySQL database language do not know what statement should be used to be able to select data from a database when it is necessary to compare with a particular date? I did the image but I get it wrong, what is the correct way?

    
asked by Flambo 17.08.2018 в 06:23
source

1 answer

0

You can write your query by filtering the year and month by using the YEAR and MONTH functions applied to the date column.

SELECT 
    customers.name,
    rentals.rentals_date
FROM customers
    INNER JOIN rentals ON rentals.id_customers=customers.id
WHERE YEAR(rentals.rentals_date) = 2016 AND MONTH(rentals.rentals_date) = 9;
    
answered by 17.08.2018 в 08:10