guarana1 Posted March 3, 2014 at 04:18 PM Report #547371 Posted March 3, 2014 at 04:18 PM (edited) Tenho a seguinte tabela Tenho de ver a "foto" que aparece mais vezes, Por exemplo, tenho 30 linhas na table, e em 30 linhas da tabela tenho 10 fotos chamadas "x", 11 fotos chamadas "y" e 9 fotos chamadas "g". Quero obter a foto que aparece mais vezes, neste caso seria a foto "y" Edited March 3, 2014 at 04:19 PM by guarana1
HappyHippyHippo Posted March 3, 2014 at 05:45 PM Report #547406 Posted March 3, 2014 at 05:45 PM (edited) select id, count(foto) as quantidade from gosto group by foto order by quantidade desc limit 1 ps : não testado Edited March 3, 2014 at 05:45 PM by HappyHippyHippo IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
bioshock Posted March 3, 2014 at 05:45 PM Report #547407 Posted March 3, 2014 at 05:45 PM (edited) SELECT *, COUNT(foto) FROM gostos GROUP BY foto ORDER BY foto DESC Edit: resposta acima. 👍 Edited March 3, 2014 at 05:46 PM by bioshock
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now