SELECT
a.customers_id, b.name, b.office, b.username, a.serial_number, a.id
FROM
user_assets AS a
left JOIN
customers AS b ON
a.customers_id = b.id
WHERE NOT
(b.username LIKE 'Warehouse')
AND (serial_number LIKE 'R8%'
OR serial_number LIKE 'LR%'
OR serial_number LIKE 'R9%')
GROUP BY
a.customers_id
HAVING (COUNT(a.customers_id) >=2);
查询应该找到哪些用户拥有多台计算机。虽然每个用户只显示一条记录,但我如何显示 serial_number 列中的所有关联行?
编辑:
删除and a.customers_id = a.customers_id
,因为它是我正在尝试的东西,并且$by
因为它不需要这个问题