create temporary table tmp_table
SELECT b.*,p.price,b.num*p.price as totalprice,p.name
FROM buycart as b
left join product as p on b.pid = p.id
where b.id=1 or b.id=2 or b.id=4 ;
select SUM(totalprice) as totalprice,GROUP_CONCAT(name separator'-') as name from tmp_table;
创建了临时表,然后从临时表中查询了数据.
用空model执行sql后报错了.SQLSTATE[HY000]: General error
请问该怎么处理呢?
我现在急着用 都不知道咋办了.
最佳答案