SQL Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10, 10' at line 47
SELECT f.*,c.*,
GREATEST
(
IFNULL
(DATE_FORMAT
(p1.latest_date1,'%Y年%m月%d日'
), '0000-00-00'
),
IFNULL
(DATE_FORMAT
(p2.latest_date2,'%Y年%m月%d日'
), '0000-00-00'
),
IFNULL
(DATE_FORMAT
(p3.latest_date3,'%Y年%m月%d日'
), '0000-00-00'
),
IFNULL
(DATE_FORMAT
(p4.latest_date4,'%Y年%m月%d日'
), '0000-00-00'
),
IFNULL
(DATE_FORMAT
(p5.latest_date5,'%Y年%m月%d日'
), '0000-00-00'
),
IFNULL
(DATE_FORMAT
(p6.latest_date6,'%Y年%m月%d日'
), '0000-00-00'
)
) AS latest_date,
(SELECT COUNT
(*
)
FROM free_travel
WHERE free_st
= '1'
AND free_book
= '1'
AND free_set_name LIKE '%雙%十%一%優%惠%'
OR free_type LIKE '%雙%十%一%優%惠%'
) AS free_book
FROM free_travel
AS f
JOIN free_travel_cate
AS c
ON f.free_cate
= c.cate_id
LEFT JOIN (
SELECT goods_id, MAX
(group_dt
) AS latest_date1
FROM app01_group
GROUP BY goods_id
) AS p1
ON f.free_id
= p1.goods_id
LEFT JOIN (
SELECT foods_id, MAX
(foods_dt
) AS latest_date2
FROM app01_foods
GROUP BY foods_id
) AS p2
ON f.free_id
= p2.foods_id
LEFT JOIN (
SELECT places_id, MAX
(places_dt
) AS latest_date3
FROM app01_places
GROUP BY places_id
) AS p3
ON f.free_id
= p3.places_id
LEFT JOIN (
SELECT cruise_id, MAX
(cruise_dt
) AS latest_date4
FROM app01_cruise
GROUP BY cruise_id
) AS p4
ON f.free_id
= p4.cruise_id
LEFT JOIN (
SELECT tours_id, MAX
(tours_dt
) AS latest_date5
FROM app01_tours
GROUP BY tours_id
) AS p5
ON f.free_id
= p5.tours_id
LEFT JOIN (
SELECT ferry_id, MAX
(ferry_dt
) AS latest_date6
FROM app01_ferry_pri
GROUP BY ferry_id
) AS p6
ON f.free_id
= p6.ferry_id
WHERE f.free_st
= '1'
AND f.free_set_name LIKE '%雙%十%一%優%惠%'
OR f.free_type LIKE '%雙%十%一%優%惠%'
ORDER BY f.free_crt_dt DESC
LIMIT -10, 10
No results found