Article View: bit.databases.mssql-l
Article #54Re: Help selecting rows
From: Clive Raphael
Date: Sat, 19 Feb 2000 00:00
Date: Sat, 19 Feb 2000 00:00
40 lines
1958 bytes
1958 bytes
You should select only the column which you want the distinct value of. If you select more than one column in your select statement then it will return more rows. The DISTINCT command is only good for one column distinction. Tim Mcphail <rhopfinger@earthlink.net> wrote in message news:38AB51E1.A7B37168@earthlink.net... > I'm a relative newbie to sql and I'm looking for a solution to the > following problem. Any help > would be greatly appreciated. > > I have a two column table. e.g.- > > location name > 1 bob > 2 john > 2 sam > 2 frank > 3 tim > > I want to select one of each of the locations. Where there are multiple > locations I want just one of > them with the associated name but I don't care which name. e.g. - > > location name > 1 bob > 2 (john, sam or frank, it doesn't matter which is returned) > > 3 tim > > I tried distinct but because it applies to the whole table I get the > same starting table. I can do > 'select distinct location' but this only returns the location and I want > an associated name (if there is > one). Thanks in advance. > > tim mcphail > mcphail@umsa7.umd.edu > >
Technical Details
Message-ID:
<EOzr4.14003$pN1.207392@news1.rdc1.nj.home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38AB51E1.A7B37168@earthlink.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6611,ea478b7668a09f74,start X-Google-Attributes: gidf6611,public From: "Clive Raphael" <c-raphael@home.com> Subject: Re: Help selecting rows Date: 2000/02/19 Message-ID: <EOzr4.14003$pN1.207392@news1.rdc1.nj.home.com> X-Deja-AN: 587449254 References: <38AB51E1.A7B37168@earthlink.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.nj.home.com 950978852 24.13.72.3 (Sat, 19 Feb 2000 08:47:32 PST) Organization: @Home Network X-MSMail-Priority: Normal NNTP-Posting-Date: Sat, 19 Feb 2000 08:47:32 PST Newsgroups: bit.databases.mssql-l