Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 3CCDA9FA304 for ; Fri, 15 Dec 2006 15:45:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 84164-02 for ; Fri, 15 Dec 2006 15:45:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mx3.ipf.is (man.ipf.is [85.197.192.163]) by postgresql.org (Postfix) with ESMTP id C12EA9FA4CF for ; Fri, 15 Dec 2006 15:45:49 -0400 (AST) Received: (qmail 15355 invoked by uid 1010); 15 Dec 2006 19:39:08 +0000 Received: from 88.149.106.19 by man (envelope-from , uid 1008) with qmail-scanner-1.25-st-qms (clamdscan: 0.88.4/1639. spamassassin: 3.1.4. perlscan: 1.25-st-qms. Clear:RC:1(88.149.106.19):SA:0(-2.5/4.5):. Processed in 3.478408 secs); 15 Dec 2006 19:39:08 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via man X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(88.149.106.19):SA:0(-2.5/4.5):. Processed in 3.478408 secs Process 15335) Received: from dsl-149-106-19.hive.is (HELO ?192.168.1.33?) (88.149.106.19) by mx3.ipf.is with SMTP; 15 Dec 2006 19:39:04 +0000 Subject: Re: join and sort on 'best match' From: Ragnar To: Ashish Ahlawat Cc: Markus Schaber , pgsql-sql@postgresql.org In-Reply-To: <682126990612150840r409ada5y234ff3ef3ac85c5f@mail.gmail.com> References: <457FC751.6080104@code-shop.com> <1166005787.6369.79.camel@localhost.localdomain> <682126990612140510j61d2268fq80235b02a550eccd@mail.gmail.com> <20061214163659.088b7236@kingfisher.sec.intern.logix-tt.com> <682126990612150840r409ada5y234ff3ef3ac85c5f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Date: Fri, 15 Dec 2006 19:46:47 +0000 Message-Id: <1166212007.6369.194.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/120 X-Sequence-Number: 27076 On fös, 2006-12-15 at 22:10 +0530, Ashish Ahlawat wrote: > > > Hi team > > I was just asking that If table ITEM3 has all the columns then why we > need to have a join ?? even we put a sorting very easily. > On 12/14/06, Markus Schaber wrote: > Hi, Ashish, > > "Ashish Ahlawat" wrote: > > > if table *Item 3 : news, nature, greenpeace, whale has all > clmn y v need > > join ??* it seems these where not columns of a table. the organisation was like this: table items: id name ----------- 1 foo 2 bar 3 item3 table tags: tag_id text --------------------- 1 news 2 nature 3 tennisballs 4 greenpeace 5 cannibals 6 whale and table items_tags: item_id tag_id ---------------- 3 1 3 2 3 4 3 6 ... so table items needs to be joined to table tags via table items_tags to retrieve the connections from item3 to news, nature, greepeace and whales. gnari