May 27, 2011 16:23
SELECT SUM( ROUND( go.r_beauty + IF( goc.percents IS NULL , 0, IF( goc.percents <=50, (
(
go.r_beauty + s.value
) * goc.percents / s2.value ) , (
- ( go.r_beauty + s.value ) * goc.percents /100 ) ) )
) + ROUND( go.r_prestige + IF( gof.percents IS NULL , 0, IF( gof.percents <=50, (
go.r_prestige * gof.percents / s3.value
), - ( go.r_prestige * gof.percents /100 ) ) ) )
) AS rate, u.id AS `user_id`
FROM fg_game_objects AS go
INNER JOIN fg_settings AS s ON ( go.color +3 ) = ( s.id )
AND go.clothe_type >=1
AND go.clothe_type <=6
INNER JOIN fg_settings AS s2 ON s2.id =1
INNER JOIN fg_settings AS s3 ON s3.id =2
LEFT JOIN fg_game_objects_colors AS goc ON go.color = goc.color_id
LEFT JOIN fg_game_objects_fasons AS gof ON go.id = gof.go_id
INNER JOIN fg_users AS u ON FIND_IN_SET( go.id, REPLACE( u.clothes, '-', ',' ) )
AND u.clothes != '0-0-0-0-0-0'
GROUP BY user_id
ORDER BY rate DESC
LIMIT 1
Показано записи 0 - 0 (1 всього, Запит виконувався 2.7093 сек)
idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra 1 SIMPLE s2 const PRIMARY PRIMARY 4 const 1 Using temporary; Using filesort 1 SIMPLE s3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE go ALL NULL NULL NULL NULL 457 Using where 1 SIMPLE s eq_ref PRIMARY PRIMARY 4 func 1 Using where 1 SIMPLE goc eq_ref PRIMARY PRIMARY 4 fmsport.go.color 1 1 SIMPLE gof eq_ref PRIMARY PRIMARY 4 fmsport.go.id 1 1 SIMPLE u ALL NULL NULL NULL NULL 191815 Using where; Using join buffer
разработчик,
лінивий програміст,
php,
маразм,
програмування,
сайт,
программирование