[英]How do you convert a parent-child (adjacency) table to a nested set using PHP and MySQL?
[英]Using SQL, how do you find the child number in a table from two columns where they are parent-child relationships?
標量子查詢將產生您想要的數據。 例如:
select
t.*,
(select count(*) from t b where b.parent_id = t.id) as child
from t
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.