Php queries all the data in table an of the mysql database, and then looks up the table B that belongs to table A with the most data.

this is a function of asking and answering questions
questions asked by users in Table A
questions answered by users in Table B

Table An is the only question corresponding to ID,
Table B PID corresponds to Table An ID users answer which question PID is which question ID
now need to output popular answer this function, that is, to pass which question is answered more times, in order to order
it is done by yourself, but it is too stupid and consumes performance. I hope you can help

.
Feb.28,2021

for example, table An is: questions, B, table is answers

then SQL is

select a.id, a.title, count(b.pid) as answer_count  from questions a, answers b where a.id=b.pid group by b.pid order by answer_count DESC;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e985ee-47488.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e985ee-47488.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?