|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Tring to find the Median
Hi,
I have written some code to find the Average score, only to find that I need to be looking for the Median score. I am not sure how I would go about getting the median instead of the average. This is what I wrote. Does anyone have any suggestion on what would be the best way to change this code to reflect the median for each set of votes? Thank you. select distinct top 5 p.fldTitle 'Production Title', count(v.idProduction) 'Number of Voters', avg(v.fldTitleScore) 'Score', v.idProduction 'Production ID', m.fldOrganization 'Company', p.fldContactPerson 'Contact Person', p.fldContactPhone 'Contact Phone Number', p.fldContactEmail 'Contact Email' from wkProductioninfo p, wkvote v, wkProductionDate d, wkMember m where p.fldPlayMusical = 0 and p.fldWorldPremiere = 1 -- and p.fldSubmitting = 0 and p.fldsolo <> 1 and p.fldTour <> 1 and p.idUser <> '10000000' and p.idUser <> '10000001' and p.idUser = m.idUser and p.idProduction = d.idProduction and d.fldClosingDate < '09/01/03' and p.idProduction = v.idProduction and v.fldTitleScore > .00 group by v.idProduction, p.fldTitle, p.fldContactPerson, p.fldContactPhone, p.fldContactEmail, m.fldOrganization having(count(v.idProduction) > 8 ) order by avg(v.fldTitleScore) desc go |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Tring to find the Median |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|