Using an INNER JOIN

I dont understand why tihs query

SELECT COUNT(*) As total_records FROM devices WHERE enabled = 1

results in


But if I add a JOIN

SELECT device_id,name,devices.manufacturer,devices.model,type,devices.created_date,title,room_id,row,bay,devices.rack_id FROM devices INNER JOIN racks ON devices.rack_id = racks.rack_id WHERE devices.enabled = 1 LIMIT 0, 25

to line up the devices with a rack_id, the result is

I don’t understand the disparity as each device has a rack_Id of 1-8. and tbe racks table is

You limited the second query to only returning 25 rows. What disparity are you pointing at other than the one you coded into the query?

2 Likes

Oh dang, forgot the limit clause, when I take it out, the thi \ng wprks great

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.