Re: query

From: CarlosAL <miotromailcarlos_at_netscape.net>
Date: Tue, 24 Feb 2009 00:07:16 -0800 (PST)
Message-ID: <1005ee9e-1548-4565-b29e-7aafc4b5e06f_at_j1g2000yqi.googlegroups.com>



On 24 feb, 02:51, Carl Forsman <fatwallet..._at_yahoo.com> wrote:
> Why the following query does not work?
> select a.Word, b.Word a.Document from data where ABS(a.Position -
> b.Position) < 3 and a.Document = b.Document
>
> I have a Table stores keywords + position of the word + document
> number 1 or 2 ... the word in.
>
> Word Position Document
> Great 1 1
> Wall 2 1
> China 3 1
> Dog 3 2
> Cat 7 2
>
> I would like to output all word that are close related ... position of
> 2 word do not more than 3 word apart :
>
> The output should be:
> (Word1)(Word2)(Document#)
> Great Wall 1
> Wall China 1
> Great China 1

Why the following query does not work?
select a.Word, b.Word a.Document from data where ABS(a.Position - b.Position) < 3 and a.Document = b.Document

Because there is a comma missing between b.Word and a.Document and you are referencing two tables (a, b) but you are only using one and without alias (data)

This query will never ever work.

Cheers.

Carlos. Received on Tue Feb 24 2009 - 02:07:16 CST

Original text of this message