Home > database >  Mysql logoff toll, how
Mysql logoff toll, how

Time:10-02

Mysql development offline members how to statistics, as well as the member in what floor?

CodePudding user response:

Please list table structure and test data, we don't know if the statistics

CodePudding user response:

What all have no, don't know how to count, please post data and table structure

CodePudding user response:

Write a recursive search stored procedures

CodePudding user response:

Set a field list, show several layers, if a person is 2, he showed 3 and so on

CodePudding user response:

The original tree traversal time consuming, please check the preamble of the data structure, in sequence, after the sequence traversal,
Tree structure can be out of shape, such as the grade of membership number, primary members a01 and secondary member a01b01 a01b01c01 level 3 members and so on...

Statistical referral number:
SELECT COUNT (1)
The FROM member_table
WHERE member_id LIKE 'a01 %'

See a few members,
The SELECT LENGTH (member_id)/3 AS member_level
The FROM member_table

(BTW now graded member "apparently suspected of national laws and regulations, the elder brothers be careful!)