ST_CONTAINS(`area`, PointFromText(CONCAT('POINT(', :latitude, ' ', :longitude, ')')));
The following comparison operators and functions are not yet supported with JSON values:
BETWEEN
IN()
GREATEST()
LEAST()
DELIMITER $
CREATE TRIGGER ...
...
END;
$
DELIMITER ;
UPDATE (
SELECT `t1`.`id` AS `id`, MAX(`t2`.`created`) AS `created`
FROM `orders` AS `t1`
JOIN `orders` AS `t2` ON `t2`.`client_id` = `t1`.`client_id`
AND `t2`.`id` <> `t1`.`id` AND `t2`.`created` <= `t1`.`created`
GROUP BY `t1`.`id`
) AS `t`
RIGHT JOIN `orders` AS `o` ON `o`.`id` = `t`.`id`
SET `o`.`diff` = `t`.`created`