![](/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.