得到成员计数与家庭细节和hof细节mysql

时间:2017-09-12 12:03:33

标签: mysql tree parent

persons table
-----------------
id name fatherid motherid famid
---------------------
 1 ras  lovely   beautiful 5    
 2 abc  def      ghi       5    
 3 xyz  abc      aay       4

family table
----------------
famid hof ( id from persons)
------------------------
    4 3
    5 2

需要输出

-------------------
membercount(id with famid) hof_name hof_id(id from person) famid
-------------------
                         2 abc      2                      5
                         1 xyz      3                      4

请帮助我获得正确的查询

0 个答案:

没有答案