Multi-table joint query problem
nearest
nearest 2017-10-24 21:26:41
0
1
1360

select pid,count(*) from table1 group by pid;

Find out the total number of occurrences of each pid,

The problem comes out,

Another one The name corresponding to the pid is placed in the table.

Now we need to directly display the number of times each name appears through a joint query.

The total number of occurrences of each name

nearest
nearest

我爱PHP

reply all(1)
路过

SELECT a.pid as pid , a.name as name, COUNT(b.pid ) as num  FROM `table1` as a, `table2` as b WHERE a.pid = b.pid;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template