If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > this SELECT query didn't work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-12, 01:00
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
this SELECT query didn't work

This SELECT query didn't work.
Code:
SELECT * FROM xcart_product_options_js
   WHERE javascript_code LIKE 'pull-down menu just above the "Take it" button'
   LIMIT 0 , 100
No records were found, even though I know those values exist. Do I need to escape the quote characters or something like that? Thank you
Reply With Quote
  #2 (permalink)  
Old 01-05-12, 04:53
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
you didn't use any LIKE wildcard characters, so the query is looking for a row with an exact match for that column value
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-05-12, 05:03
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Code:
SELECT * FROM xcart_product_options_js
   WHERE javascript_code LIKE '%pull-down menu just above the "Take it" button%'
   LIMIT 0 , 100
Ok, then is this correct? But it still does not find the records...
Reply With Quote
  #4 (permalink)  
Old 01-05-12, 05:09
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
You do not need to escape the double quotes so it does look alright. If this does not work then I would look more closely at my data in the database.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #5 (permalink)  
Old 01-05-12, 11:04
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Quote:
Originally Posted by r937 View Post
you didn't use any LIKE wildcard characters, so the query is looking for a row with an exact match for that column value
Yes, that is probably the issue, as I am not looking for an exact match...just a match of that string within the entire column value. How do I add wildcard characters to the query, please?
Reply With Quote
  #6 (permalink)  
Old 01-05-12, 11:11
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by Leafgreen View Post
Yes How do I add wildcard characters to the query, please?
you did this already, in post #3 -- the percent signs

as ronan said, look at your data more closely
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-11-12, 04:45
Leafgreen Leafgreen is offline
Registered User
 
Join Date: Apr 2008
Posts: 36
Nope. It's the query syntax. If I execute
Code:
SELECT *
FROM `xcart_product_options_js`
WHERE `javascript_code` LIKE '%pull-down menu just above the%'
LIMIT 0 , 30
then I get a found set. if I execute
Code:
SELECT *
FROM `xcart_product_options_js`
WHERE `javascript_code` LIKE '%pull-down menu just above the ''Take it'' button%'
LIMIT 0 , 30
then I get no results. The problem is the quotes in ''Take it''. I've also tried " character. BTW, if I try searching just Take it then I also do not get any results. The '' messes things up. Please help. Thank you.
Reply With Quote
  #8 (permalink)  
Old 01-11-12, 06:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by Leafgreen View Post
Please help. Thank you.
do you know how to dump a table?

please dump the table, then copy both the CREATE TABLE statement, as well as the INSERT statement for at least one row which contains the data that you're trying to return with this query
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On