Jump to content

using Double Quotes in Select Query


natasha_sharma
Go to solution Solved by Psycho,

Recommended Posts

I am using mysql statement in some other software using odbc.

value = odbcconnectSQL("select MATCH(product_group) AGAINST ( ' +shrimp' IN BOOLEAN MODE) as score from company_info WHERE isin='abcd' AND  MATCH(industry, product_group, products, raw_material, business_desc, gisc_ind_2) AGAINST ( '     +shrimp' IN BOOLEAN MODE) ");

Problem is I want to use below keyword instead of +shrimp:

 

"+shrimp  +(export OR import)  "

 

Now the problem is, I am not able to use the Double quotes in this sql statement.

 

How to fix that?

 

Link to comment
Share on other sites

  • Solution

Maybe I am not understanding. Are the double quotes supposed to be part of the text to be compared against or are you intending for them to be delimiters?

 

If the double quotes are meant to be part of the text to be compared against, then you can escape them (using a backslash).

 

value = odbcconnectSQL("select MATCH(product_group)
                            AGAINST ( '\"+shrimp  +(export OR import)  \"' IN BOOLEAN MODE) as score
                        from company_info WHERE isin='abcd'
                         AND  MATCH(industry, product_group, products, raw_material, business_desc, gisc_ind_2)
                             AGAINST ( '\"+shrimp  +(export OR import)  \"' IN BOOLEAN MODE) ");

 

But, if you are wanting to use the double quotes as a delimiter for the string, I'm not understanding why since the single quotes would work just fine.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.