데이터베이스 오류가 발생하였습니다.

Error Number: 1064

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 '001021001' at line 146

select a.pid, a.name, a.stay_name, a.imgurl1, a.tags, a.hits, a.event_words, a.google_place_id, a.intro_sentence, a.goods_character, a.google_rating, b.stay_yn, b.green_fee_yn, b.singleroom_yn, b.cart_fee_yn, b.caddie_fee_yn, b.caddie_tip_yn, b.pickup_fee_yn, b.breakfast_yn, b.lunch_yn, b.dinner_yn, substr(concat(if(b.stay_yn='Y',',숙박',''),if(b.green_fee_yn='Y',',그린피',''),if(b.singleroom_yn='Y',',싱글룸',''),if(b.cart_fee_yn='Y',',카트비',''),if(b.caddie_fee_yn='Y',',캐디피',''),if(b.caddie_tip_yn='Y',',캐디팁',''),if(b.pickup_fee_yn='Y',',차량픽업',''),if(b.breakfast_yn='Y',',조식',''),if(b.lunch_yn='Y',',중식',''),if(b.dinner_yn='Y',',석식','')),2) as included, b.price, b.price2, b.currency, c.purchase_num, d.steamed, f.name as cate_name, fn_get_cate_name(substr(a.cate_code, 1, 6),'name') as country, fn_get_cate_name(substr(a.cate_code, 1, 9),'name') as city from goods a LEFT JOIN ( select goods_pid, package_name, stay_yn, green_fee_yn, singleroom_yn, cart_fee_yn, caddie_fee_yn, caddie_tip_yn, pickup_fee_yn, breakfast_yn, lunch_yn, dinner_yn, room_words, golf_words, price, price2, currency, (case @v_goods_pid when a.goods_pid then @rownum:=@rownum+1 else @rownum:=1 end) as rnum, (@v_goods_pid:=a.goods_pid) as v_goods_pid from ( select a.goods_pid, a.package_name, a.stay_yn, a.green_fee_yn, a.singleroom_yn, a.cart_fee_yn, a.caddie_fee_yn, a.caddie_tip_yn, a.pickup_fee_yn, a.breakfast_yn, a.lunch_yn, a.dinner_yn, a.room_words, a.golf_words, a.price, a.price2, a.currency, a.sort_no from ( select a.goods_pid, a.opt_name as package_name, a.opt_pkg01 as stay_yn, a.opt_pkg02 as green_fee_yn, a.opt_pkg03 as singleroom_yn, a.opt_pkg04 as cart_fee_yn, a.opt_pkg05 as caddie_fee_yn, a.opt_pkg06 as caddie_tip_yn, a.opt_pkg07 as pickup_fee_yn, a.opt_pkg08 as breakfast_yn, a.opt_pkg09 as lunch_yn, a.opt_pkg10 as dinner_yn, a.ext01 as room_words, a.ext02 as golf_words, round(a.price1 * coalesce(c.rate, 1)) as price, round(a.price2 * coalesce(c.rate, 1)) as price2, left(b.cate_code,6) as country_code, case when left(b.cate_code,6) in('001012','001021') and a.opt_pkg12 = 'Y' then '엔' else '원' end as currency, case when left(b.cate_code,6) in('001012','001021') then case when a.opt_pkg11 = 'Y' and a.opt_pkg12= 'Y' then 1 when a.opt_pkg01 = 'Y' then 2 else 3 end else 3 end as sort_no from goods_add_options a LEFT JOIN goods b ON a.goods_pid = b.pid LEFT JOIN currency c ON a.currency_pid = c.pid where a.shown = 'Y' and a.view_yn = 'Y' ) a JOIN (select @v_goods_pid:=0, @rownum:=0 from dual) b ) a order by a.goods_pid, a.sort_no, a.price ) b ON a.pid = b.goods_pid and b.rnum = 1 LEFT JOIN ( select goods_pid, sum((( to_days(check_out)-to_days(check_in) )+1)*buynum) as purchase_num from order_cart group by goods_pid ) c ON a.pid = c.goods_pid LEFT JOIN ( select goods_id, steamed_id as steamed from steamed where user_id = 0 ) d ON a.pid = d.goods_id LEFT JOIN ( select a.code, a.name, concat(b.name,'/',a.name) as cate_path from category a LEFT JOIN category b ON substr(a.code,1,6) = b.code and length(b.code) = 6 where length(a.code) = 9 and a.gubun = 1 ) e ON substr(a.cate_code,1,9) = e.code LEFT JOIN category f ON f.gubun=1 and a.cate_code = f.code where a.del_yn='N' and a.open_yn='Y' and a.approval_yn='Y' and date_format(now(),'%Y-%m-%d %H:%i') <= a.end_date #and a.cate_code like '%' #and a.rounding_yn='' #order by rand() 001021001

Filename: /home/staygolf/public_html/new_mvc/models/goods.php

Line Number: 1197