• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

very technical ( sql writing)

hi experts,
I have  two tables as below:
1-   articleAid,description,title,abstract,location); AID=P.K    
2-keywords( AID,keyword) ; aid+keyword=p.k , aid=f.k      
I want to search for special keywords in article for special keywords that users enter in entry place( edit.text).
We have two branch of keywords
1-     usual keyword ( that separated with spaces)
2-     included keyword(that at frist of these keywords come ‘+’ sign  as google page )
suppose you have two arrays for invidual keywords.
I don’t need any coding for seprating of keywords.
example:
online +Delphi demo +example
mean of this example:

search for articles that should include (Delphi and example together) keywords and (online,demo   one or twice in articles that have DELPHI EXAMPLE  ) .


the mean of my sql request as below:

if  have all(included keywords) then
     begin
        if have(space keyword) then
          search for usual keywords in result of (included keywordsßpayattention)
       else
          return the result of search for(included keywordsßpayattention )
    end
else
   search for usual keywords in articlesß pay attention


can anyone write sql statement for this issue?

Thanks in advance
   



God bless you
Hamid reza

0
123456
Asked:
123456
  • 9
  • 3
  • 2
  • +1
1 Solution
 
kretzschmarCommented:
what is a space keyword?
0
 
123456Author Commented:
sorry
usual keyword that seperated with space sign
0
 
123456Author Commented:
sorry,
(usual keyword) my purpose.

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
123456Author Commented:
any feed back from you meiki?
0
 
rondiCommented:
You will need to write code to parse the keywords
entered by the user and generate a SQL query based on
the user's input.

You'll need to increase the points to 200...!
0
 
123456Author Commented:
dear rondi,
If I increase my points don’t differ for you.
As I known , don’t pay money(or …) to high point experts .
And actually experts answer to questions  with no attention to this issue.
If you give me  a EMAIL,  I will send  you my suggestions about why use this site of a word that was named points?

But about your comment:
I told in my question that suppose have a two arrays(one for usual and other for included keywords because I write a program that parse the entry of users ) .

GOD BLESS YOU
Hamid Reza
0
 
123456Author Commented:
any feed back from you, kretzschmar?
0
 
123456Author Commented:
please help me kertzschmar the time of my progeh is over.
hamid reza

0
 
kretzschmarCommented:
sorry for delay, i have just too much to do

can you send me a sample-database and
a description (with sample) what should happen?

send it to info@meikl.de

because i'm not sure what you will archieve

meikl ;-)
0
 
123456Author Commented:
hi,
I had solved this problem with two changes
1-
Add another table and create m_n relationship:
My tables:
1-article(Aid,description,title,abstract,location); AID=P.K                                        relation:
2-keywordarticle( AID,keywordID) ; aid+keyword=p.k , aid=f.k,keywordID =f.k           article M:N   keyword
3-keyword(keywordID,keywordname);  keywordid:p.k

2- at first I create a temporary table and save included keywords in this table.
and search usual keywords in this table for my resulting.
my coding as below.
At first write this sql  for finding included keywords

Select aid from article where
(AID  in  (Select aid from KeyWordArticles where KeyWordId = (Select KeyWordId from KeyWords where KeywordName = 'included#1'))  and
AID  in  (Select aid from KeyWordArticles where KeyWordId = (Select KeyWordId from KeyWords where KeywordName = 'included#2'))) or etc

Create temprorarytable
// included table   Temprorytable(aid); aid=p.k
 After it  Fill temporarytable records with my query fields.

Finally:
Search for usual keywords in temporarytable with this sql statement:

select aid from article where  aid in ( select aid from  temprorytable where aid in (select aid from keywordarticle where keywordID in
(select keywordID from keyword where keywordname in (‘usual  keyword#1’,’ usual  keyword#1’,’ usual  keyword#1’,etc))))
 
what is your opinion about my work for sloving this problem?

Please pay attention:
but one problem that remained of my previous question (    http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20560521.html ) in entering data .
can you solve this problem(locate problem) or have a another idea ?

thanks
hamid reza
0
 
kretzschmarCommented:
glad you got it work,
but asking myself why there is a need for a temp-table,
but curently i'm too tired, because going too late to bed
yesterday, respectivle todays-morning.

taking later a closer look, after some cups of coffee ;-)

i posted an alternative in the other q

your tired

meikl ;-)
0
 
123456Author Commented:
hi,
With increasing  included keywords the number of results  is decreamented.
I store my results in one table(temprory) and search for usual keywords in this table.
This way is better when the number of articles is so high and The number of included keywords is high.
If I don’t have a mistake in learning sql mean.
If you have other idea please say?

thanks in advance
0
 
123456Author Commented:
i want to close this question


thanks
0
 
moduloCommented:
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/CleanUp/Q_20576144.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
0
 
moduloCommented:
Saving this Q as a PAQ and refunding the 50 points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 9
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now