We’ve all done it…after looking at it forever and sure it’s right, then you show it to someone and they go “it’s right there” and you want to go hide in a hole.
SELECT chassises.chassis_id AS asset_id,chassises.name,asset_type,chassises.created_by,chassises.created_date,count(port_id)
FROM ports
INNER JOIN chassises ON ports.chassis_id = chassises.chassis_id
Dang, I really bad at explaining…
I have 2 tables which are connected (ports foreign key is chassises primary key. Im trying to put data from both using
SELECT chassises.chassis_id AS asset_id,chassises.name,asset_type,chassises.created_by,chassises.created_date,count(port_id)
FROM ports
INNER JOIN chassises ON ports.chassis_id = chassises.chassis_id
If I look in the ports table, only 3 ports have a chassis_id of 1 and only 1 has a chassis_id of 2 .
If I attach a GROUP BY clause I get