How to create a relatively complex MySQL query I'm not good with MySQL but have been trying to create a query that would join from three tables where:

Table 1 (macs) is like this:
ipAddr, vlanID, macAddress, interfaceName

Table 2 (network_devices) is like this:
network_device_id, nd_location, nd_name, nd_ip_address, etc

Table 3 (vlans) is like this:
vlan_id, vlan_name

And I got this query thats works:

SELECT 
    m.vlanID
    , m.interfaceName
    , count(m.macAddress) as mac
    , n.nd_name 
FROM macs m, network_devices n 
WHERE 
    n.nd_ip_address = m.ipAddr 
GROUP BY 
    n.nd_name 
ORDER BY 
    m.vlanID


Which provides the following:
vlanID, interfaceName, mac, nd_name

And works ok. I'm now trying to add to this result the vlan_name which is in the vlans table.

How can I get this or where can I find information that would help me with this?
If I understand then this is what you want:

SELECT   m.vlanID, v.vlan_name, m.interfaceName, count(m.macAddress) as mac, n.nd_name
FROM     macs m, network_devices n, vlans v
WHERE    n.nd_ip_address = m.ipAddr
AND      m.vlanID        = v.vlan_id
GROUP BY m.vlanID, v.vlan_name, m.interfaceName, n.nd_name
ORDER BY m.vlanID