I want to count two things in different conditions in one query.
SELECT COUNT(*) AS count FROM table_name WHERE name = ?
and
SELECT COUNT(*) as count FROM table_name WHERE address = ? AND port = ?
I need to have a counter for strings that have a specific address and a specific port, and a SEPARATE account for strings with a specific name.
I know what I can do
SELECT (COUNT*) as count FROM table_name WHERE (address = ? AND port = ?) OR name = ?
However, this is the only account, and I need them to be separate, so I can display a more accurate message for the user.
How can i do this? Help will be appreciated!
source share