Created
December 15, 2012 20:40
-
-
Save aTei/4298988 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT `videos`.`name`, `videos`.`episodes`, `videos`.`is_ended`, `videos`.`id`, `videos`.`logo`, `videos`.`type`, | |
| `user_videos`.`episode`, `user_videos`.`last_change`, `user_videos`.`status`, | |
| `video_scores`.`score`, | |
| ( SELECT `video_names`.`name` | |
| FROM `video_names` | |
| WHERE (`video_names`.`lang` = 'ru' OR `video_names`.`lang` = 'en') | |
| AND `video_names`.`vid_id` = `videos`.`id` | |
| LIMIT 1) as alt_name | |
| FROM (`videos`) | |
| JOIN `user_videos` ON `user_videos`.`vid_id` = `videos`.`id` | |
| LEFT JOIN `video_scores` ON `video_scores`.`vid_id` = `videos`.`id` and video_scores.user_id = 553 | |
| WHERE `user_videos`.`user_id` = '553' AND `user_videos`.`status` = '1' | |
| GROUP BY `videos`.`id` | |
| ORDER BY `user_videos`.`last_change` desc | |
| LIMIT 400 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment