tech291083 Posted September 3, 2006 Report Share Posted September 3, 2006 i have just started learning php and mysql on my own after installig fedora 5 on my laptop just a week ago. i have creatd a table (winners) in mysql (from command line) and it has 2 columns. one is countryName and another is year. just like country and the year it won the football world cup. i want to make a query in terms of the names of the country/countries who have won the cup more than say 2 times. but i m struggling with it can any one help. the query i have created is select countryName,count(*) as numberOfWins from winners where count(*)>2 group by country order by numberOfWins asc; thanks. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted September 3, 2006 Report Share Posted September 3, 2006 Not sure about the count bit as of yet, but what will get you the records would be something like: select * from countryName where countryName=('UK'); for example, would pull records for UK. Quote Link to comment Share on other sites More sharing options...
jboy Posted September 3, 2006 Report Share Posted September 3, 2006 Try this: select countryName, count(*) as numberOfWins from winners group by countryName having count(*)>2 order by numberOfWins asc; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.