realestate
中的我希望得到
字段address
<&lt; = 5且&gt; = 0的记录数,并将其分配给counta
字段address
为&lt; = 12且&gt; = 6并将其分配给countb
依旧......
答案 0 :(得分:1)
select (select count(address)
from realestate
where address <= 5 and address >= 0) as counta,
(select count(address)
from realestate
where address <= 12 and adress >= 6) as countb
答案 1 :(得分:1)
可能更容易阅读between
:
select
(select count(address) from realestate
where address between 0 and 5) as counta,
(select count(address) from realestate
where address between 6 and 12) as countb