Whether the original method of laravel can join subqueries

The granularity of the data stored in the

table is relatively fine, so you need to make statistics according to the two fields in the table.

select B.col2,count(col2),sum(t.num)
from (
    select col1,col2,count(col3) as num
    from A
    where A.status = 1
    group by A.col2
) as t
left join B on t.col1 = B.col1
group by col1
Feb.27,2021

of course. You can take a look at this article. I hope it will be helpful to you.

Laravel Query Builder complex query case: subquery implements partition query partition by

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-1e50919-450df.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-1e50919-450df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?