数据库中某些报错,及修改方式

1.0数据库报错提示:

Unknown column 'SH20181121231434247489' in 'where clause'

错误原因:在sql中,拼接语句是拼接不当,这会出现该提示。

实际操作过程中,传入一个订单号以此来获取这个订单的信息。

报错时的写法:

$all=pdo_fetch("select a.price,a.status,a.createtime,b.title,b.total from ims_ewei_shop_order as a left join ims_ewei_shop_order_goods as b on a.id=b.orderid where a.ordersn=".$ordersn,array());

修改完后的写法:

$all=pdo_fetch("select a.price,a.status,a.createtime,b.title,b.total from ims_ewei_shop_order as a left join ims_ewei_shop_order_goods as b on a.id=b.orderid where a.ordersn='$ordersn'",array());

2.0数据库报错提示:

Row size too large. The maximum row size for the used table type, not

原因:数据表中的所有字段都是有一定的长度。所有的长度和不能超过某个值。之前以为要存放多图所以,有的长度是8000,所以修改这个长度就好了。

3.0错误提示:Every derived table must have its own alias

原因在于嵌套mysql后,需要加一个别名。必须要加但是没有实际作用
select * from (select goodsid,GROUP_CONCAT(title) as title,GROUP_CONCAT(stock) as 
stock,GROUP_CONCAT(presellprice) as presellprice,GROUP_CONCAT(marketprice) as 
marketprice,GROUP_CONCAT(productprice) as productprice,GROUP_CONCAT(costprice) as 
costprice,GROUP_CONCAT(goodssn) as goodssn,GROUP_CONCAT(productsn) as 
productsn,GROUP_CONCAT(weight) as weight  from ims_ewei_shop_goods_option where goodssn 
like '%mm%' GROUP BY goodsid ) #as total#

你可能感兴趣的:(数据库中某些报错,及修改方式)