I have the following table:
A FromA User
1 NULL Bob
2 1 Bob
3 1 Chris
4 2 Chris
User is the name of the person who created item A. FromA is the source that the User grabbed it from.
I want to figure out is Chris’ most frequency source.
My query
SELECT count(T1.A GROUP BY T1.User), T1.User
FROM Table T0
INNER JOIN Table T1 ON T0.FromA=T1.A
WHERE T0.User='Chris'
It should return Bob=2. But it doesn’t seem to work.
Try this:
The
limit 1will give you just the most frequently used source.Edit:
Nope. Here is a working example