Not sure why MySQL would not allow you to join tables but if all the fields you need to query are contained in one table then maybe this example will help.
Assume you have a Database with a table called MyTable
and that it contains a field called MyValue.
Assume there are 3 records containing the value 1,
2 records containing the value 22 and 1 record containing the value 5.
The SQL could be written as:
SELECT Distinct MyValue, Count(MyValue) AS CountOfMyValue
FROM MyTable
GROUP BY MyValue
ORDER BY Count(MyValue) DESC;
This would return:
MyValue CountOfMyValue
1 3 (as in 3 instances of the value 1)
22 2 (as in 2 instances of the value 8)
5 1 (as in 1 instances of the value 5)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.