我有以下查询,它从“ac_pms”表中选择个人消息(PM)。附加信息正在从其他表中获取 - “ac_accounts”使用LEFT JOIN
. “ ”表中有“ pm_read
”列ac_pms
定义是否读取PM。我需要在选择 PM 时将该字段 ( pm_read
) 设置为 " "。1
SELECT p.*, a.seller_id, a.winner_id
FROM `ac_pms` AS p
LEFT JOIN `ac_accounts` AS a ON p.pm_for_lot = a.id
WHERE (p.pm_from=[user_id] OR p.pm_to=[user_id])
AND p.pm_for_lot=[account_id]
ORDER BY p.pm_date DESC;
我无法想象在哪里插入UPDATE
表达式SET pm_read = 1
。