dbTalk Databases Forums  

query

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss query in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carl Forsman
 
Posts: n/a

Default query - 02-23-2009 , 07:51 PM






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


Reply With Quote
  #2  
Old   
CarlosAL
 
Posts: n/a

Default Re: query - 02-24-2009 , 02:07 AM






On 24 feb, 02:51, Carl Forsman <fatwallet... (AT) yahoo (DOT) com> wrote:
Quote:
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.


Reply With Quote
  #3  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: query - 02-24-2009 , 06:33 AM



Carl Forsman escribió:
Quote:
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

You have posted the very same question comp.databases.mysql ... Are you
actually using Oracle?



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.