A co po prostu:
SELECT
SUM(IF(name = ?, 1, 0)) AS name_count,
SUM(IF(address = ? AND port = ?, 1, 0)) AS addr_count
FROM
table_name
A co po prostu:
SELECT
SUM(IF(name = ?, 1, 0)) AS name_count,
SUM(IF(address = ? AND port = ?, 1, 0)) AS addr_count
FROM
table_name