?
Solved

very technical ( sql writing)

Posted on 2003-03-26
15
Medium Priority
?
222 Views
Last Modified: 2010-04-04
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
Comment
Question by:123456
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 3
  • 2
  • +1
15 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8212505
what is a space keyword?
0
 
LVL 2

Author Comment

by:123456
ID: 8215549
sorry
usual keyword that seperated with space sign
0
 
LVL 2

Author Comment

by:123456
ID: 8215616
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.

 
LVL 2

Author Comment

by:123456
ID: 8216953
any feed back from you meiki?
0
 
LVL 3

Expert Comment

by:rondi
ID: 8217054
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
 
LVL 2

Author Comment

by:123456
ID: 8223373
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
 
LVL 2

Author Comment

by:123456
ID: 8230520
any feed back from you, kretzschmar?
0
 
LVL 2

Author Comment

by:123456
ID: 8237457
please help me kertzschmar the time of my progeh is over.
hamid reza

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8237805
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
 
LVL 2

Author Comment

by:123456
ID: 8243059
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8243404
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
 
LVL 2

Author Comment

by:123456
ID: 8254945
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
 
LVL 2

Author Comment

by:123456
ID: 8278985
i want to close this question


thanks
0
 

Expert Comment

by:modulo
ID: 8280407
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
 

Accepted Solution

by:
modulo earned 0 total points
ID: 8301985
Saving this Q as a PAQ and refunding the 50 points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question