我已经构建了这个SQL查询,应该在其中放置最高的日期值
field_result
SELECT
field_one,
field_two,
IF(((field_one IS NOT NULL AND field_one <> '') AND
(field_one > TableB.field_two)),
unix_timestamp(field_one),
unix_timestamp(TableB.field_two)) AS result
FROM TableA
LEFT JOIN TableB ON TableB.id = TableA.id
条件非常简单。
-
field_one
必须存在,并且包含某种值。
-
如果
field_one > field_two
显示
否则显示
field_two
"field_one", "field_two", "field_result"
"1495681346","1500328106","1500328106"
"1500342725","1500328106","1500328106"
"1499922505","1500329807","1500329807"
"1500343148","1500328106","1500328106"
"1500329593","1500328106","1500328106"
出于某种原因
row 2
field_结果
1500342725
(该值约为
14619
1500328106