Sunday, 1 September 2013

sql query left join records missing

sql query left join records missing

$list="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 and a.customers_id =
a.customers_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)
$by";
the query should find which users have multiple computers. only one record
per user is showing though, how can i show all associated rows from the
serial_number column?

No comments:

Post a Comment