MariaDB [enwiki_subset]> select cl_type, cl_sortkey, cl_from from categorylinks where cl_to = 'A.F.C._Emley' order by cl_type, cl_sortkey, cl_from\G *************************** 1. row *************************** cl_type: page cl_sortkey: A.F.C. EMLEY cl_from: 5664196 *************************** 2. row *************************** cl_type: subcat cl_sortkey: PLAYERS A.F.C. EMLEY PLAYERS cl_from: 18585943 *************************** 3. row *************************** cl_type: file cl_sortkey: AFCEMLEY.PNG cl_from: 19575733 3 rows in set (0.00 sec) MariaDB [enwiki_subset]> select cl_type, cl_sortkey, cl_from from categorylinks where cl_to = 'A.F.C._Emley' order by cl_type, cl_sortkey, cl_from limit 1\G *************************** 1. row *************************** cl_type: page cl_sortkey: A.F.C. EMLEY cl_from: 5664196 1 row in set (0.00 sec) MariaDB [enwiki_subset]> select cl_type, cl_sortkey, cl_from from categorylinks where cl_to = 'A.F.C._Emley' and cl_type > 'page' order by cl_type, cl_sortkey, cl_from limit 1\G *************************** 1. row *************************** cl_type: subcat cl_sortkey: PLAYERS A.F.C. EMLEY PLAYERS cl_from: 18585943 1 row in set (0.00 sec) MariaDB [enwiki_subset]> select cl_type, cl_sortkey, cl_from from categorylinks where cl_to = 'A.F.C._Emley' and cl_type > 'subcat' order by cl_type, cl_sortkey, cl_from limit 1\G Empty set (0.00 sec) MariaDB [enwiki_subset]> select cl_type, cl_sortkey, cl_from from categorylinks where cl_to = 'A.F.C._Emley' and cl_type > 'file' order by cl_type, cl_sortkey, cl_from\G *************************** 1. row *************************** cl_type: page cl_sortkey: A.F.C. EMLEY cl_from: 5664196 *************************** 2. row *************************** cl_type: subcat cl_sortkey: PLAYERS A.F.C. EMLEY PLAYERS cl_from: 18585943 2 rows in set (0.00 sec)