我需要一个选择查询,它会从类别ID 1中获取第一个视频,然后是第二个类别的第一个视频,然后是类别3的第一个视频,依此类推剩余类别
然后是类别1的第二个视频,然后是类别2的第二个视频,依此类推。
这是我的数据库表结构:
CREATE TABLE videos(
video_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
video_filename CHAR(255),
video_title CHAR(255),
description CHAR(255),
video_category INT UNSIGNED,
video_levels INT UNSIGNED,
video_type INT UNSIGNED,
status INT UNSIGNED
);
INSERT INTO videos VALUES
(1, 'L_1_F_1.mp4', 'Michael Jordan', 'Michael Jordan Footwork', 4, 1, 0, 1),
(4, 'L_2_B_1.mp4', 'ball', 'handling', 3, 1, 0, 1),
(3, 'L_1_C_2.mp4', 'Core Training', 'Core Training', 1, 1, 0, 1),
(5, 'L_1_S_1.mp4', 'Jukes', 'test jukes', 2, 1, 0, 1)
;
表格:
| VIDEO_ID | VIDEO_FILENAME | VIDEO_TITLE | DESCRIPTION | VIDEO_CATEGORY | VIDEO_LEVELS | VIDEO_TYPE | STATUS |
------------------------------------------------------------------------------------------------------------------------------
| 1 | L_1_F_1.mp4 | Michael Jordan | Michael Jordan Footwork | 4 | 1 | 0 | 1 |
| 3 | L_1_C_2.mp4 | Core Training | Core Training | 1 | 1 | 0 | 1 |
| 4 | L_2_B_1.mp4 | ball | handling | 3 | 1 | 0 | 1 |
| 5 | L_1_S_1.mp4 | Jukes | test jukes | 2 | 1 | 0 | 1 |
上查看