Home > database >  Pray god to help see article group ranking statement. An error occured in multi - table update. No p
Pray god to help see article group ranking statement. An error occured in multi - table update. No p

Time:09-23

The set @ row=0;
The set @ mid=0;
The set @ cid=0;
The update hotmcontent_ranking_20190304_20190310 inner join (
SELECT id, apid, acid, readcount,
Case the when @ mid=apid and @ cid=acid then @ row:=@ row + 1 else @ row:=1 end ranking,
@ mid:=apid,
@ cid: acid=
The FROM hotmcontent_ranking_20190304_20190310
Where acid<> 0
The order by apid, acid, readcount desc
) c on hotmcontent_ranking_20190304_20190310. Id=c.i d set hotmcontent_ranking_20190304_20190310. Ranking=c.r anking;


Now An error: An error occured in multi - table update
Table there are nearly 3 million data,
I want to make data grouping and then ranking,
Ranking, the ranking field make uncertain, a wait online

CodePudding user response:

CodePudding user response:

What can't, have no language,,

CodePudding user response:

Give you change, don't know whether logic,
If slow, increase the index apid, acid, readcount,
The UPDATE
Hotmcontent_ranking_20190304_20190310 t
SET
T.r anking=
(SELECT
COUNT (0)
The FROM
(SELECT
T.a pid,
T.a cid,
T.r eadcount
The FROM
Tt hotmcontent_ranking_20190304_20190310 t)
WHERE tt. Apid=t.a pid
AND tt. The acid=t.a cid
AND tt. Readcount & lt;=t.r eadcount);

CodePudding user response:

reference AHUA1001 reply: 3/f
give you change, don't know if the logic is such,
If slow, increase the index apid, acid, readcount,
The UPDATE
Hotmcontent_ranking_20190304_20190310 t
SET
T.r anking=
(SELECT
COUNT (0)
The FROM
(SELECT
T.a pid,
T.a cid,
T.r eadcount
The FROM
Tt hotmcontent_ranking_20190304_20190310 t)
WHERE tt. Apid=t.a pid
AND tt. The acid=t.a cid
AND tt. Readcount & lt;=t.r eadcount);


Thank you, I am the first group and then calculate the rankings ranking
This is the total number, are you?
  • Related