1
查詢的一部分我沒有得到;這些內部連接在做什麼?沒有得到這個MySQL查詢
我有表speeldatum有所有的數據,在我的project.below查詢正在改變價值的rownum列,我怎麼不明白。在查詢中沒有內部連接,rownum列的值爲零,我沒有正確理解mysql用戶在查詢中定義的vriable。
樣品輸出(不考慮ROWNUM值ORDER)
...., ROWNUM 0 ....
..., ROWNUM 1,...
..., ROWNUM 2, ...
from speeldatums as t
inner join (select @rownum:=0) as r
inner join (select @prev:="") as r2
inner join (select @prevdatum:="") as r3**
完整查詢:
'create temporary table rr_prepare (rownum INT NOT NULL, datum_unix
INT(11) NULL, categorie VARCHAR(20) NOT NULL, entry_id INT NOT NULL,
INDEX(rownum), INDEX(datum_unix), INDEX(categorie), INDEX(entry_id))
ENGINE=MyISAM
select t.*, @rownum:=if(@prev=t.categorie and
@prevdatum=t.datum,@rownum+1,0) as rownum, @prev:=t.categorie as
prevcategorie, @prevdatum:=t.datum as prevdatum
from speeldatums as t inner join (select @rownum:=0) as r
inner join (select @prev:="") as r2
inner join (select @prevdatum:="") as r3 ';
你想達到什麼目的? –
你的問題到底是什麼? –