🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.sqlinfo
Article #331

Re: SQL Problem

#331
From: Günter Nowak
Date: Tue, 31 Aug 1999 00:00
45 lines
2090 bytes

Mark & Lee schrieb:

> Can someone please help me as I am new to SQL and having a bit of trouble
> with an assignment. Problem is:
>
> I need to create a single textfile with a statement that addresses the
> following:
>
> This query is about tracks that have the same length on the same album. For
> each pair of such tracks, display one row showing the length, the album
> code, and the title of each matching track,
>
> e.g. 191     7599-27313-2      Dont Stop     I dont want to know
>
> cannot show the same pair of tracks more than once, i.e with the track
> titles swapped around.
>
>       191    7599-27313-2     Dont Stop          I dont want to know
>       191   7599-27313-2      I dont want to know           Dont Stop.
>
> What I have done so far is,
>
>     Select Length,AlbumCode,TrackTitle from Tracks
> Group by Length,AlbumCode,Tracktitle
> having count (Length) >1;
>
> but of course query is looking for Length,AlbumCode and Tracktitle which has
> a count greater than 1...Result NIL
>
> How can I get around this?????
>
> Mark

I 'm not sure if I really understand your question. Perhaps this is a solution

Select T1.Length,T1.AlbumCode,T1.TrackTitle,T2.TrackTitle
from Tracks T1,Tracks T2
where
 T1.Length=T2.Length and
 T1.AlbumCode=T2.AlbumCode and
 T1TrackName<T2.TrackName

guenter nowak
Technical Details
Message-ID: <37CC3EEE.174B3B9F@chello.at>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <BB1x3.3180$hf4.41942@nsw.nnrp.telstra.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11355a,9aa628f52dd40962
X-Google-Attributes: gid11355a,public
From: Günter Nowak <elisabeth.weisskircher@chello.at>
Subject: Re: SQL Problem
Date: 1999/08/31
Message-ID: <37CC3EEE.174B3B9F@chello.at>
X-Deja-AN: 519449647
Content-Transfer-Encoding: 7bit
References: <BB1x3.3180$hf4.41942@nsw.nnrp.telstra.net>
X-Accept-Language: de,en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news@telekabel.at
X-Trace: news.chello.at 936132074 212.186.99.231 (Tue, 31 Aug 1999 22:41:14 MET DST)
Organization: Chello Austria
MIME-Version: 1.0
NNTP-Posting-Date: Tue, 31 Aug 1999 22:41:14 MET DST
Newsgroups: bit.listserv.sqlinfo