Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
select DISTINCT(cctv_id), cctv.[name] from points_cctv left join cctv on points_cctv.[cctv_id] = cctv.[id]
我想计算points_cctvwhere的记录数points_cctv.[cctv_id] = cctv.[id]并将其显示为上述查询中的附加列。当我插入count(points_cctv.[cctv_id])时,它只会给我一行。
points_cctv
points_cctv.[cctv_id] = cctv.[id]
count(points_cctv.[cctv_id])
select cctv_id, cctv.[name], count(cctv_id) from points_cctv left join cctv on points_cctv.[cctv_id] = cctv.[id] group by cctv_id, cctv.name