Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sangoku
Starting Member
19 Posts |
Posted - 2009-09-05 : 07:25:44
|
| Hy i have again a BIG problem, i am on the verge of failing i have the folowing querry:SELECT MONTH(Rodjendan) AS MjesecRodjenja, count(month(Rodjendan)) as BrojRodjendana FROM KorisnikGROUP BY MONTH(Rodjendan)ORDER BY MONTH(Rodjendan) DESC and i get MjesecRodjenja BrojRodjendana7 25 23 12 1how can i only show the results with only maximall "BrojRodjendana" is shown PLEASE HELP me out im stuck on a test....while earth still spininglive on, have funelsemove to mars |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-05 : 08:25:25
|
| select top 1 with ties * from (SELECT MONTH(Rodjendan) AS MjesecRodjenja, count(month(Rodjendan)) as BrojRodjendana FROM KorisnikGROUP BY MONTH(Rodjendan)) as tORDER BY BrojRodjendana DESCMadhivananFailing to plan is Planning to fail |
 |
|
|
sangoku
Starting Member
19 Posts |
Posted - 2009-09-05 : 08:45:06
|
| I already solcved it XD sorry to bother you it was like:USE WebForumGoDECLARE @tableTem table (MjesecRodjenja int, BrojRodjenja int)DECLARE @MaxVrednost int INSERT @tableTemSELECT MONTH(Rodjendan), count(month(Rodjendan)) FROM KorisnikGROUP BY MONTH(Rodjendan)SELECT @MaxVrednost = (SELECT MAX(BrojRodjenja) FROM @tableTem)SELECT * FROM @tableTemWHERE BrojRodjenja = @MaxVrednostand i solved it XDwhile earth still spininglive on, have funelsemove to mars |
 |
|
|
|
|
|