On December 13, 2009 01:36:41 pm Richard Reina wrote:
> I was wondering if someone could lend a hand with the following query. I
> have table.
> |ID |trans_no|comp_id|result
> 13 | 455 | 675 | o
> 15 | 302 | 675 | o
> 16 | 455 | 675 | o
> 12 | 225 | 629 | y
> SELECT count(*) FROM SEARCHES WHERE comp_id=675 AND result='o' GROUP BY
> gives me a count of 3.
> However, what I need is a count for how many different (unique)
> transactions company number 675 got a result 'o' which would be 2 (455 &
> 302). I have tried different group by columns but to no avail. Can
> someone help?
select count(trans_no), comp_id from SEARCHES group by comp_id
I think that should do it...haven't tested it though,
Living your life is a task so difficult, it has never been attempted before.