Problem with duplicate values

sumdumgai

Registered User.
Local time
Today, 02:08
Joined
Jul 19, 2007
Messages
453
I have two tables, T1 and T2. T1 has field F1 with values A, A, A, B, B, C, D, D. T2 has field F2 with values A, B, B, B, C, D. I need a query that will give me a count of every F1 value that is in F2. If I just join the fields, I get F1: A(3), B(6), C(1) and D(2). In other words, I'm getting F1(A) X F2(A) instead of F1(A) X F2(1). If F2 had no duplicate values, I'd be fine. Can someone please give me an example query to only consider unique values in F2? Thanks.
 
Code:
SELECT F2 FROM T2 GROUP BY F2

That gives you unique F2 values in T2. Then you use that query (not T2) to get your counts.
 
Thank you.
 

Users who are viewing this thread

Back
Top Bottom