Anda dapat JOIN
kueri Anda kembali ke tabel utama sebagai subkueri, untuk mendapatkan baris dan nama file asli:
SELECT
main.number,
main.file
FROM
table AS main
/* Joined against your query as a derived table */
INNER JOIN (
SELECT number, COUNT(*) AS sum domains
FROM table
WHERE RIGHT(file, 2) = '_1'
GROUP BY number
HAVING sum domains > 1
/* Matching `number` against the main table, and limiting to rows with _1 */
) as subq ON main.number = subq.number AND RIGHT(main.file, 2) = '_1'
http://sqlfiddle.com/#!2/cb05b/6
Perhatikan bahwa saya telah mengganti LIKE '%_1'
Anda dengan RIGHT(file, 2) = '_1'
. Sulit untuk membedakan mana yang akan lebih cepat tanpa patokan.