![](/img/trans.png)
[英]Set-based query to find all columns in table that contain at least one null value
[英]Query to find districts with at least one value in assets table
这是我的SQL查询:
select count(*) from district
但我只想选择存储表资产中至少具有1个值的所有区。 (可以大于1)
所以
select all districts that have at least 1 entry in assets
表资产:ID名称district_id
表区ID名称
我怎样才能做到这一点?
select count(*)
from district
where exists (
select 1
from assets
where district_id = district.id
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.