List:General Discussion« Previous MessageNext Message »
From:Dto. Sistemas de Unitel Date:April 20 2005 7:29am
Subject:Query problem
View as plain text  
 

Hi,

I’m trying to make a query that need to search throught a table and have to
search different terms, and SUM their Rank (is for a small search engine I
have to design), this is the table:

Table Indexes

ID – bigint 
ID_Termino -bigint
Rank – double

Table Terminos

ID_Termino – bigint – Primary key
Termino – Varchar(50)

Table productos

ID – bigint
prod_descripcion – varchar(255)

 

I have another engine that search throught text and apply a Rank to each
word and store it on table indexes and if this word doesn’t exist it store
it in table terminus and the id of this word is related in indexes table.
Indexes is related with another table called productos that is the one that
is analyzed by my engine. When any client ask to me for search “computer
intel” y search with the next query, but the results aren’t 100% good
because I have to use a clause OR in termino, but I want to use there
something like an and (something like indexes.id=productos.prod_id and
indexes.id_termino=terminos.id_termino and termino="computer" and
termino=”intel” I know that is impossible, but maybe there is another way to
make that). 

SELECT STRAIGHT_JOIN

terminos.id_termino,productos.prod_descripcion,indexes.id,terminos.termino,s

um(indexes.rank) as ordenate,productos.prod_unitel_id FROM
terminos,indexes,productos where indexes.id=productos.prod_id and
indexes.id_termino=terminos.id_termino and termino="computer" or
indexes.id=productos.prod_id and indexes.id_termino=terminos.id_termino and
termino="intel" group by (indexes.id) order by ordenate desc

Thanks for all and best regards,

Roberto


Attachment: [text/html]
Attachment: [text/html]
Attachment: [text/html]
Thread
Query problemDto. Sistemas de Unitel20 Apr
Re: Query problemRoger Baklund20 Apr
Re: Query ProblemDto. Sistemas de Unitel20 Apr
Re: Query ProblemRoger Baklund20 Apr
  • RE: Query ProblemDto. Sistemas de Unitel21 Apr
Re: Query ProblemRoger Baklund21 Apr
  • RE: Query ProblemDto. Sistemas de Unitel21 Apr
Re: Query ProblemRoger Baklund22 Apr
  • RE: Query ProblemDto. Sistemas de Unitel22 Apr