Skip to content

Instantly share code, notes, and snippets.

@alecnunn
Created December 20, 2013 13:17
Show Gist options
  • Select an option

  • Save alecnunn/8054634 to your computer and use it in GitHub Desktop.

Select an option

Save alecnunn/8054634 to your computer and use it in GitHub Desktop.
SELECT
machines.mid as `ID`, machines.ip as `IP`,
GROUP_CONCAT(services.port) as `Ports`
FROM
machines, services
WHERE
machines.mid = services.mid
GROUP BY
machines.mid;
+----+-------------+--------+
| ID | IP | Ports |
+----+-------------+--------+
| 1 | 192.168.0.1 | 80,443 |
+----+-------------+--------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment