Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
update borrowdetails set LM_Status = 'BORROWED' where LM_Status = 'D' and Borrow_DueDate <= now()
Borrow_DueDate是Duedate列,但它是一个varchar,我想把它当作日期时间..
Borrow_DueDate
Duedate
varchar
update borrowdetails set LM_Status = 'BORROWED' where LM_Status = 'D' and str_to_date(Borrow_DueDate,'%Y-%m-%d') <= now()
这会将您的列转换为日期
UPDATE `borrowdetails ` SET `Borrow_DueDate` = str_to_date( `Borrow_DueDate`, '%Y-%m-%d' )