MySQL query to count the number of unique users sending to the database

There are about 1000 registered users in the database. I would like to know how many of these users actually wrote a question or answered. All information can be taken from the tblQA table, and the user ID is "intPosterID", each of the questions and answers has its own identifier "PostID". Is there a query that you can run to calculate how many unique users have posted a question or answer?

+5
source share
4 answers

Counting individual user identifiers can be done using:

SELECT COUNT( DISTINCT intPosterID ) FROM tblQA;

COUNT( DISTINCT field ) - intPosterID .

+5

:

SELECT COUNT(PostID), intPosterID FROM tblQA GROUP BY intPosterId

= ConroyP

+1

COUNT (column name DISTINCT) can be used for this:

SELECT COUNT(DISTINCT intPosterId) FROM tblQA; 
+1
source

That should do it.

select count(intPosterID)
from tblQA
group by intPosterID;
0
source

All Articles