
mysql – 将所有记录保存在“WHERE IN()”子句中,即使找不到它们也是如此
我有以下mysql查询:SELECT id, sum(views) as total_views FROM table WHERE id IN (1,2,3) GROUP BY id ORDER BY total_views ASC 如果在数据库中只找到id 1,3,我仍然希望出现id 2,其中total_views设置为0.有没有办法做到这一点?这不能使用
我有以下mysql查询:SELECT id, sum(views) as total_views FROM table WHERE id IN (1,2,3) GROUP BY id ORDER BY total_views ASC 如果在数据库中只找到id 1,3,我仍然希望出现id 2,其中total_views设置为0.有没有办法做到这一点?这不能使用