update ad_category set order_total=order_total+1 where category_id = (select a.category_id as i,b.category_id as id,c.category_id as ids,d.category_id as idss from ad_category as a,ad_category as b,ad_category as c,ad_category as d where a.parent_id=b.category_id and b.parent_id=c.category_id and c.parent_id=d.category_id and a.category_id=10);这样会报错Operand should contain 1 column(s) 注:一条sql就能搞定 不要多条sql或存储过程..... 感谢各位大侠 在线等.......
| category_id | int(11) | NO | PRI | NULL | auto_increment |
| category_name | varchar(100) | NO | | NULL | |
| parent_id | int(11) | NO | | NULL | |
as 是保留字,改改update ad_category ad inner join(select a.category_id as i,b.category_id as id,c.category_id as ids,d.category_id as idss from ad_category as a,ad_category as b,ad_category as c,ad_category as d where a.parent_id=b.category_id and b.parent_id=c.category_id and c.parent_id=d.category_id and a.category_id=10) asson ad.category_id=ass.category_idset ad.order_total=ad.order_total+1 where 1;