A
A
Andrey Veryaskin2016-12-01 09:50:48
MySQL
Andrey Veryaskin, 2016-12-01 09:50:48

Why doesn't STR_TO_DATE work in a subquery?

Why does this query not work in mysql :


CREATE TABLE IF NOT EXISTS __temp_orders
( SELECT * FROM orders WHERE STR_TO_DATE(orders.data,'%d.%m.%Y') < '2016-11-01 09:35:00' )

writes to me
[HY000][1411] Incorrect datetime value: '' for function str_to_date

Although a separate subquery

SELECT * FROM orders WHERE STR_TO_DATE(orders.data,'%d.%m.%Y') < '2016-11-01 09:35:00'
works great and returns what I want to create the table from.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question