var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Count without including duplicates
I have a php mySQL database which records clients visits to a free advice clinic. There is a ‘matters’ table which, amongst others, has fields:
I want to get totals from this (between certain dates but that isn’t an issue) but I only want to count a client once no matter how many different matters they have set up.
If I use 'SELECT DISTINCT clientname' then I get a list with no duplicates but if I add 'count(*) as total' the total includes duplicates so is incorrect.
How can I get round this?
Sorry - I have worked this out now using COUNT(DISTINCT clientname) as total which seems to work fine. I do have a more complicated question though which I will add as a new post.