List:General Discussion« Previous MessageNext Message »
From:Richard Reina Date:December 13 2009 6:36pm
Subject:Query help
View as plain text  
I was wondering if someone could lend a hand with the following query.  I have table.

SEARCHES
|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 trans_no;

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?

Thanks,

Richard
Thread
Query helpRichard Reina13 Dec
  • RE: Query helpJason Trebilcock13 Dec
  • Re: Query helpColin Streicher13 Dec
  • Re: Query helpDaWiz13 Dec