我想更新数据库,如果计数(mycnt)是1只有不其他数字只有1否则没有更新数据库。我已经做了下面的工作,我不知道如何在这个事件调度程序中设置if条件。请帮帮我。我有以下问题。
select a.user_id, count(*) as mycnt
from auction_details a
inner join users u on a.user_id = u.user_id
where PRODUCT_ID='1'
GROUP BY bidprice
order by bidprice;
结果如下:
在事件调度器中
BEGIN
update products p join auction_details a on a.product_id = p.product_id
join users u on u.user_id = a.user_id
set p.winner = (select user_id from auction_details a where
p.product_id = a.product_id order by bidprice DESC LIMIT 1)
WHERE p.end_time <=NOW() and p.product_status='active';
End
暂无答案!
目前还没有任何答案,快来回答吧!