{'product_id' : 'count', 'product_id' : 'count}
SELECT `c`.`id`
FROM `chair` AS `c`
LEFT JOIN `tickets` AS `t` ON `t`.`chair_id` = `c`.`id`
AND :desiredTime < (`t`.`time_from` + INTERVAL 30 MINUTE)
AND `t`.`time_from` < (:desiredTime + INTERVAL 30 MINUTE)
WHERE `t`.`chair_id` IS NULL
/{\%(.*?\%})\%}/i
/{%([^{}%]*(?:(?R)|)[^{}%]*)%}/
SELECT `t2`.`number`, `t2`.`area` AS `newarea`, `t2`.`date` AS `lastdate`,
`t3`.`area` AS `oldarea`, `t3`.`date` AS `prevdate`
FROM (
SELECT `number`, MAX(`date`) AS `maxdate`
FROM `table`
GROUP BY `number`
) AS `t1`
JOIN `table` AS `t2` ON `t2`.`number` = `t1`.`number` AND `t2`.`date` = `t2`.`maxdate`
JOIN `table` AS `t3` ON `t3`.`number` = `t1`.`number` AND `t3`.`date` < `t3`.`maxdate`
AND `t3`.`area` < `t3`.`area`
1 + 1 * 2 => <число(1)> <плюс> <число(2)> <умножить> <число(2)>