简体   繁体   中英

How do i query and select a specific date

How do i query and select only the date. Because in my database the value is in datettime. I only want to select the date in my query, it is giving me and error. But when i put the time it is working.

Here is my query

 sql =  "SELECT teamone,teamtwo,s_name, s_gender, start, end, v_name FROM `sport` 
    inner JOIN `matches` ON `matches`.`s_id` = `sport`.`s_id` left JOIN `schedule` ON  
`schedule`.`m_id` = `matches`.`m_id` left join `venue` ON `schedule`.`v_id` = `venue`.`v_id`
        Where start = '2016-12-09 10:00:00' ORDER by start asc";

Start is a datetime or timestamp. You need only date u must be 'date' for data type. If you use datetime or timestamp u must be '0000-00-00 00:00:00'. mysql date and times data types . You can use this site for questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM