Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Search query for File Path

 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have file path in my table(mysql). I am using search functionality which search the file path according different criteria.

where first match is for locale 2nd for item and last for file name. I am stuck at last match where DCRPath LIKE '%data%' which is for file name. It showing some undesirable result.


I understand why this is wrong, but what can be the right query for this.
 
Paul Clapham
Sheriff
Posts: 21955
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain what is wrong and/or undesirable about that list? Each of the entries in it does match your query, so what's wrong with that? (Note: I don't understand why you say %data% is for "file name" when it clearly means "anything containing the string 'data'".)
 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are right. There should no result come as there is no file which contains the "data" . if i place "Gfr" it should display one record only as in last row.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vivek dhiman wrote:you are right. There should no result come as there is no file which contains the "data" . if i place "Gfr" it should display one record only as in last row.

Not really. In fact all your files contain "data"
/templatedata/composite-item/gallery/data/3_Local/EU/fr_BE/Electronics/sw_fr_BE_7931

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!