Aeolus Posted August 19, 2009 Share Posted August 19, 2009 I would really like to count this > I'd like to know how many rows are returning with matching c_id, basically, how many rows am I selecting here.. Version 5.0.51b INSERT INTO `e_result` ( `c_id`, `name`, `d_score`, `c_score`, `j_score`, `score`, `rank` ) SELECT $c_id, a.`name`, a.`d_score`, a.`c_score`, a.`j_score`, a.`score`, @MYCOUNTER:= @MYCOUNTER + 1 AS `rank` FROM ( SELECT `name`, @DVAR:=(`nat_d` + `tra_d` + FLOOR( {$natModifierMin} + RAND() * ({$natModifierMax} - {$natModifierMin}))) AS `d_score`, @CVAR:=(`nat_c` + `tra_c` + FLOOR( {$natModifierMin} + RAND() * ({$natModifierMax} - {$natModifierMin}))) AS `c_score`, @JVAR:=(`nat_j` + `tra_j` + FLOOR( {$natModifierMin} + RAND() * ({$natModifierMax} - {$natModifierMin}))) AS `j_score`, @DVAR + @CVAR + @JVAR AS `score` FROM `horses` WHERE `c_id`=$c_id ) AS `a` WHERE 1=1 ORDER BY a.`score` Link to comment https://forums.phpfreaks.com/topic/170995-counting-a-subquery/ Share on other sites More sharing options...
Aeolus Posted August 19, 2009 Author Share Posted August 19, 2009 Does anyone have any suggestions? Link to comment https://forums.phpfreaks.com/topic/170995-counting-a-subquery/#findComment-901875 Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 Yikes... what's all this about? Link to comment https://forums.phpfreaks.com/topic/170995-counting-a-subquery/#findComment-903220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.