SQL実行時エラー
[ SELECT pcs.i_id AS i_id , item.item_name AS item_name , item.file_type AS file_type , item.set_flg AS set_flg , item.file_format AS file_format , item.file_size AS file_size , item.amount AS amount , item.price AS price , item.sale_type AS sale_type , item.point_rate AS point_rate , item.sale_start_time AS sale_start_time , item.update_time AS update_time , item.movie_play_time AS movie_play_time , detail.img_main AS img_main , seller.seller_id AS seller_id , seller.user_name AS user_name , COUNT(item.i_id) AS purchases , CASE WHEN (item.sale_type = 0 AND item.price > 0) THEN item.price WHEN item.sale_Type = 0 THEN item.amount ELSE 0 END AS sort_amount , item.c_id AS c_id , item.cm_id AS cm_id , IFNULL(mst_category_m.category_name, '') AS category_name FROM ( SELECT i_id AS i_id , COUNT(i_id) AS counter FROM t_download_history WHERE DATE_FORMAT(reg_time, \"%Y%m\") = \"201906\" GROUP BY i_id ORDER BY COUNT(i_id) DESC LIMIT 0, 100 ) AS pcs INNER JOIN t_item AS item ON(pcs.i_id = item.i_id) LEFT OUTER JOIN t_item_detail AS detail ON(item.i_id = detail.i_id) LEFT OUTER JOIN t_seller AS seller ON(item.s_id = seller.s_id) LEFT OUTER JOIN t_mst_category_m AS mst_category_m ON(item.cm_id = mst_category_m.cm_id) WHERE pcs.i_id > 1000 AND item_status = 0 AND NOW() >= sale_start_time AND item.termination_flg = 0 AND (sale_end_time > NOW() OR sale_end_never_flg = 1) AND del_flg = 0 AND sale_type = 0 AND seller.termination_flg = '0' GROUP BY item.i_id LIMIT 0, 50 ]