Displaying data horizontally in mysql
user can insert record only two files with the same major


SELECT t1.major, t1.files file1, t2.files file2
FROM db_school t1
LEFT JOIN db_school t2 ON t1.major = t2.major
                      AND t1.id &lt; t2.id