Home > Backend Development > PHP Tutorial > How does mysql query the value of id = category id in the same table?

How does mysql query the value of id = category id in the same table?

WBOY
Release: 2016-08-04 09:21:54
Original
1163 people have browsed it

I want to check how many members each user recommended? What members are there?

As shown in the picture How does mysql query the value of id = category id in the same table?

Reply content:

I want to check how many members each user recommended? What members are there?

As shown in the picture How does mysql query the value of id = category id in the same table?

<code>select id,user_name,(select count(1) from user where recommend_id=u.id )recommend_count  from user u</code>
Copy after login

Use aliases to turn this table into two tables and just associate them

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template