Re: Average of top n query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Uri Dimant (urid_at_iscar.co.il)
Date: 03/22/04


Date: Mon, 22 Mar 2004 10:30:54 +0200

Hi, David
Yep , I was thinking to use WITH TIES but as I understood he does not
matter about the same salary.OP was not clear about that but now as I
reviewing his post I think you are right.

"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:F7Gdnf1czsKwPMPdRVn-gg@giganews.com...
> > SELECT AVG(DISTINCT salary)
> > FROM Employees AS E
> > WHERE
> > (SELECT COUNT(*)
> > FROM Employees
> > WHERE salary > E.salary) < 3
>
> Oops. I think this is what I meant:
>
> SELECT AVG(DISTINCT salary)
> FROM Employees AS E
> WHERE
> (SELECT COUNT(DISTINCT salary)
> FROM Employees
> WHERE salary > E.salary) < 3
>
> --
> David Portas
> SQL Server MVP
> --
>
>



Relevant Pages

  • all greek bastards are liquid and other russian peers are superior, but will Janet deserve that
    ... The employees, ... I relax inland processings in the sad level ... Otherwise the matter in Mohammad's ... Mahammed never conceives until Talal touchs the ...
    (rec.arts.sf.written)
  • Re: WWVB reception indicator needed
    ... >consultants were in the same legal status as employees, ... bought up the remnants needed my design so they paid up. ... partially bone dry as well but it doesn't seem to matter much. ... vertical blank period and then use it so that VCR clocks work right. ...
    (sci.electronics.design)
  • Re: Antennas or urine stream contests?
    ... it now seems to suffer the same malignant plague as many others--disagreements decaying into personal insults. ... I will never forget the time I had a boss who tried to enforce civilness. ... Employees who are not civil to other employees "go someplace else" eventually. ... Not a matter of enforcement, just a matter of slowly adjusting the workplace. ...
    (rec.radio.amateur.antenna)
  • Re: CRB Check?
    ... They are entitled to ask for a CRB check (it will depend on the level ... They are entitled to impose CRB checks on new employees. ... different matter from doing it for existing employees. ... the conviction, she may even lose her job if the conviction is taken ...
    (uk.legal)
  • Re: CRB Check?
    ... They are entitled to ask for a CRB check (it will depend on the level ... They are entitled to impose CRB checks on new employees. ... different matter from doing it for existing employees. ... the conviction, she may even lose her job if the conviction is taken ...
    (uk.legal)