我正在尝试问题中写的内容,可能是一个愚蠢的问题,但我找不到解决方案,基本上这就是我想做的:
if(a.operator_id!=0){
UPDATE ".$SupportTicketsTable." a ,".$SupportUserTable." b
SET a.title=? , a.priority=?, a.ticket_status=?,
b.solved_tickets= CASE
WHEN a.ticket_status!='0' THEN (b.solved_tickets+1)
ELSE b.solved_tickets END ,
b.assigned_tickets= CASE
WHEN a.ticket_status!='0' THEN (b.assigned_tickets-1)
ELSE b.assigned_tickets END ,a.ticket_status='0'
WHERE a.enc_id=? AND b.id=a.operator_id
}
else{
UPDATE ".$SupportTicketsTable." a ,".$SupportUserTable." b
SET a.title=? , a.priority=?, a.ticket_status=?
ELSE b.assigned_tickets END ,a.ticket_status='0'
WHERE a.enc_id=?
}
当a.operator_id=0
没有b.id
匹配条件的值时有没有办法只在一个查询中做到这一点?提前致谢