I need to do something like the following
SELECT p.name,
(SELECT COUNT(p.id) FROM products WHERE products.parent_id = p.id) AS sub_products
FROM products AS p
I see lots of LINQ examples of subqueries in the where clause,but nothing like this where it's in the select statement.
This query should be equivalent: