asp.net - T-SQL Select and count from different table? -
asp.net - T-SQL Select and count from different table? -
i have table (threads) containing field (id). select every row threads, number of rows in table posts field posts.thread same threads.id.
how can done in sql?
(something pseudo-sql: select *, count(* posts posts.id=threads.id) threads)
select t.id, count(p.thread) threads t left outer bring together posts p on t.id = p.thread grouping t.id
asp.net sql tsql
Comments
Post a Comment