Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Select Query with Comma Seperated Value

 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I'm doing a project in JSP and MySQL. In my page there is a text box and a submit Button named Search.

When I enter in the textbox "Aravind,23,male".. it has to go into the database and has to search for "Aravind" whose age is "23" and sex is "male" and has to display the output

When I enter in the textbox "Aravind" it has to go into the database and has to search for all "Aravind" and has to get the result

When I enter "23" it has to bring all the name, whose age is equal to "23"

How can i do this in JSP and MySQL

My table design is like this



Please help me Ranchers, I want to show the demonstration before tomorrow evening.

Kind Regards

Aravind Prasad
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One question: if you are managing an entity that has three distinct attributes, why did you choose to manage it via a single text area? Would three seperate form elements not be a better strategy?

Assuming you can't change the requirements, you have to first split the input into its three parts. This is fairly easy, looking at the JavaDocs for String will give you a way (it is slightly complicated because your requirements allow garbage input, but you can work round that).

Beyond that - what you are asking seems to be code written for you, which is not what we do here. What parts don't you understand? What have you written so far?
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou very much for your reply.

But what i'm asking is exactly the searching in orkut. How can we do like that.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the question remains: why implement it in a way that is not useful when it can be improved on? Are you planning on being 'just as good as orkut' or better?
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear David,
Thanks for the reply. I'm not going to start something like orkut. But I'm currently working in a project which can search everything. for egs.

Q1) Place where I can get a spaner size 32 in California
Q2) Cardiology specialist, whose consultation fees is $50
Q3) Where can I fix puncher of my new Pajero with in $2.

These kind of funny funny questions. This is the project which I'm currently doing.

in the text box i will enter

Q1) spanner,size 32, California and press search
Q2) Doctor,Cardiology, $50
Q3) Workshop,puncher,Pajero,$2

Something like this..

Please help me to solve this problem..... How exactly I can search the details..

I hope Ranchers can help me like anything in this..

regards

Aravind Prasad
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allowing random free text searches against a database is difficult, because of the structure of data in relational databases. Have you considered an IR (Information Retrieval) system such as Lucene? It might suit your requirements better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic