Sql:
復制代碼 代碼如下:
SELECT
@rownum:=@rownum+1 AS rownum,
a.order_id ,
case when a.Ordered =1 then '已分單' end as Ordered,
a.printed ,
a.order_sn ,
a.user_id ,
b.user_name ,
a.consignee ,
a.tel ,
a.mobile ,
a.address ,
a.pay_name ,
a.goods_amount ,
a.shipping_fee ,
FROM_UNIXTIME(a.add_time+8*3600) ,
a.postscript ,
a.best_time
FROM (SELECT @rownum:=0) r,xj_order_info a INNER JOIN xj_users b on a.user_id =b.user_id
where (order_status ='1') and (FROM_UNIXTIME(a.add_time) between '{0}' and '{1}')
ORDER BY rownum asc
sql語句在Navicat中查詢沒有問題,但在程序中各種報錯。
嘗試過將@改為?,也嘗試過傳參的方法,但都不成功。
最後,還是在StackOverflow中找到了解決方案:
Allow User Variables=True;
問題成功解決。