我想一提两个不同的情况。
SELECT COUNT(*) AS count FROM table_name WHERE name = ?
以及
SELECT COUNT(*) as count FROM table_name WHERE address = ? AND port = ?
I need to have a count for rows that have a certain address 以及 certain port, 以及 a SEPARATE count for rows that have a certain name.
我知道我可以这样做。
SELECT (COUNT*) as count FROM table_name WHERE (address = ? AND port = ?) OR name = ?
However that is a single count, 以及 I need them to be separate so I can display a more accurate message to the user.
我怎么做? 希望!