MySQL - Counting two things with different conditions
问题 I want to count two things under 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 count for rows that have a certain address and certain port, and a SEPARATE count for rows that have a certain name. I'm aware that I could do SELECT (COUNT*) as count FROM table_name WHERE (address = ? AND port = ?) OR name = ? However that is a single count, and I need them to