0
Staff need to perform a count of how many distinct records exist in a field, but my filtering condition is based on another field.
Example of how the data are organized:
PDV | DESC
----------------
410 | "Automa"
410 | "Automa"
410 | "Automa"
150 | "Automa"
150 | "Automa"
150 | "Automa"
831 | "Automa"
831 | "Automa"
Query I made:
SELECT COUNT(PDV) FROM Table WHERE DESC ='Automa'
What I need to count is how many different Pdvs exist with the same description.
The result I got was 8
what I hope to receive is 3
since I have 3 distinct Pdvs
What is your DBMS?
– Sorack
MSSQL. It worked! thank you very much!
– Marcos Felipe Rezende Xavier
If the answer has met you do not forget to accept it as correct to help people with similar doubts
– Sorack