I am relatively new programmer. I am trying to create a left join with count of unique rows in a specific column. with normal count it is working fine, nut with unique it is failing.
count(case when x.priorities = 112 then 1 end) as Urgent.
it is pulling all the records. I need to convert it into unique records.
i am looking for a direction or syntax which i can try.
Try using "COUNT(DISTINCT..)" clause instead of "COUNT".
Here is a simple example to do this(if we have a table named "students" with a column "department" and we want to count the number of unique departments represented in the table):
For your requirement try this:
Replace column names as per your need.