我正在尝试进行多次计数,每个人都在接受第一个子选择 (list1) 我收到一条错误消息“Operand should contain 1 column(s)”我猜它有与 AND 有关,但我不确定如何解决这个问题。
Select Count(list0.ustatus) AS finished_count
, (Select list1.ustatus, Count(*)
From listofupdates list1
Where list1.ustarted != '0000-00-00 00:00:00'
AND list1.ustatus != 1
) AS start_count
, (Select Count(list2.udifficulty)
From listofupdates list2
Where list2.udifficulty = 2
) AS recheck_count
, (Select Count(list3.udifficulty)
From listofupdates list3
Where list3.udifficulty = 4
) AS question_count
From listofupdates as list0
Where list0.ustatus = 1
我完全同意@Chad Birch 的观点
以下查询应该有效。
Select Count(list0.ustatus) AS finished_count
, (Select Count(*)
From listofupdates list1
Where list1.ustarted != '0000-00-00 00:00:00'
AND list1.ustatus != 1
) AS start_count
, (Select Count(list2.udifficulty)
From listofupdates list2
Where list2.udifficulty = 2
) AS recheck_count
, (Select Count(list3.udifficulty)
From listofupdates list3
Where list3.udifficulty = 4
) AS question_count
From listofupdates as list0
Where list0.ustatus = 1
我是一名优秀的程序员,十分优秀!