Subject | Re: SQL Searching on JOINed tables |
---|---|
Author | ntcl1234 |
Post date | 2005-10-03T16:13:26Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
intersection between 24000 hits and 33000 hits takes ages. But
that's a data issue.
Neil
wrote:
> At 08:20 AM 3/10/2005 +0000, you wrote:are
> >I need to do a search on a table in a Firebird db, looking for the
> >occurence of two words in a particular piece of text. The words
> >indexed in the table against chapter, section, paragraph and line.(ALLENENC_1.LINE
> >I've produced an SQL string:
> >
> >SELECT DISTINCT ALLENENC.WORD, ALLENENC.CHAPTER, ALLENENC.SECTION
> >FROM ALLENENC INNER JOIN ALLENENC AS ALLENENC_1 ON
> >= ALLENENC.LINE) AND (ALLENENC.PARAGRAPH = ALLENENC_1.PARAGRAPH)AND
> >(ALLENENC.CHAPTER = ALLENENC_1.CHAPTER) AND (ALLENENC.SECTION =token
> >ALLENENC_1.SECTION) WHERE (((ALLENENC.WORD)='PAIN') AND
> >((ALLENENC_1.WORD)='LEFT'));
> >
> >where the table is called ALLENENC. The WORD column is indexed.
> >This sql works in other db's I've tried but in Firebird (using
> >dotNet), I get the error(s)
> >
> >No message for error code 335544569 found.
> >No message for error code 335544436 found.
> >No message for error code 335544634 found.
> >No message for error code 335544382 found.
>
> All of these are genuine error codes, all relating to an unknow
> (keyword) in your DSQL statement.link
>
>
> >I can open one table and search on one word but it won't let me
> >in a second instance of the table.aliased; and
>
> Sure you can, but make sure that *both* hits on the table are
> I think you will find that the keyword 'AS' is the one causingthe 'unknown
> token' error. Write your query along these lines:Thanks Helen - that worked fine. Problem now is getting an
>
> SELECT DISTINCT
> a1.WORD, a1.CHAPTER, a1.SECTION
> FROM ALLENENC a1
> JOIN ALLENENC a2
> ON a2.LINE = a1.LINE
> AND a1.PARAGRAPH = a2.PARAGRAPH
> AND a1.CHAPTER = a2.CHAPTER
> AND a1.SECTION = a2.SECTION
>
> WHERE a1.WORD='PAIN'
> AND a2.WORD='LEFT';
>
> ./heLen
intersection between 24000 hits and 33000 hits takes ages. But
that's a data issue.
Neil