🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.databases.mssql-l
Article #18

Re: SQL Query - please help!!!

#18
From: Robert Djabarov
Date: Sat, 22 May 2004 21:34
23 lines
2033 bytes
  You need to create a function that would return TOP 2 or TOP 3, and then
link this function with your CategoryMaster table.

  "ComputerMan" <talktome@btinternet.com> wrote in message
news:c0m8fq$jks$1@hercules.btinternet.com...
  > I am looking for a SQL command that allows me to list for example the
top 2
  > or 3 values for each category. for example I have a table with names,
town,
  > salary. I want the names of the two people who have the highest salaries
in
  > each town.  Imagine the towns are Liverpool, Southport, London. the
result
  > of query should give me two names for each town and the names, towns and
  > salaries must be listed.  The listed names must be those who get the
highest
  > salaries in each town. Looked in every book but not found it. I found a
Top
  > command but didn't give me the correct results. Hope someone can help.
  > Thanks
  >
  >
  >
Technical Details
Message-ID: <sHPrc.6168$be.809@newsread2.news.pas.earthlink.net>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!pd7cy2so!pd7cy1no!shaw.ca!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!cabe2bb1!not-for-mail
References: <c0m8fq$jks$1@hercules.btinternet.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6611,ddad40cdb9245699
X-Google-Attributes: gidf6611,public
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!pd7cy2so!pd7cy1no!shaw.ca!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!cabe2bb1!not-for-mail
From: "Robert Djabarov" <Robert.Djabarov@iccs-consulting.com>
Newsgroups: bit.databases.mssql-l
References: <c0m8fq$jks$1@hercules.btinternet.com>
Subject: Re: SQL Query - please help!!!
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <sHPrc.6168$be.809@newsread2.news.pas.earthlink.net>
Date: Sat, 22 May 2004 21:34:16 GMT
NNTP-Posting-Host: 69.91.6.226
X-Complaints-To: abuse@earthlink.net
X-Trace: newsread2.news.pas.earthlink.net 1085261656 69.91.6.226 (Sat, 22 May 2004 14:34:16 PDT)
NNTP-Posting-Date: Sat, 22 May 2004 14:34:16 PDT
Organization: EarthLink Inc. -- http://www.EarthLink.net