6

How to Separated Values of Single Column and Match Them in MySql

Suppose You Have a Table promo_code  in Your Database  Like This:

add comma separated values in mysql ,comma separated values in mysql ,comma separated values in mysql data type ,comma separated values in mysql field ,comma separated values in mysql group by ,comma separated values in mysql in clause ,comma separated values in mysql into multiple rows ,comma separated values in mysql join ,comma separated values in mysql query ,comma separated values in mysql search ,comma separated values in mysql selection ,comma separated values in mysql stored procedure ,comma separated values in mysql where clause ,comma separated values into rows in mysql ,comma separated values to table in mysql ,compare comma separated values in mysql ,convert comma separated values into columns in mysql ,convert rows to comma separated values in mysql ,count comma separated values in mysql ,delete comma separated values in mysql ,extract comma separated values in mysql ,get column values as comma separated in mysql ,get comma separated values in mysql ,get comma separated values in mysql group by ,get comma separated values in mysql php ,get count of comma separated values in mysql ,get values from comma separated string in mysql ,how to compare comma separated values in mysql ,how to convert comma separated values into rows in mysql ,how to count comma separated values in mysql ,how to display comma separated values in mysql ,how to get column values separated by comma in mysql ,how to get comma separated values in mysql ,how to get comma separated values in mysql query ,how to get the row values as comma separated by a query in mysql ,how to insert comma separated values in mysql ,how to insert comma separated values in mysql stored procedure ,how to insert comma separated values in mysql table ,how to insert comma separated values in mysql using php ,how to match comma separated values in mysql ,how to pass comma separated values in mysql ,how to pass comma separated values to stored procedure in mysql ,how to remove comma separated values in mysql ,how to retrieve comma separated values in mysql ,how to save comma separated values in mysql ,how to separate comma separated values in mysql ,how to split comma separated values in mysql ,how to store comma separated values in mysql ,how to sum comma separated values in mysql ,insert comma separated values in mysql ,insert comma separated values in mysql php ,insert comma separated values in table mysql ,mysql comma separated values in a field ,mysql query finding values in a comma separated string ,remove comma separated values in mysql ,replace comma separated values in mysql ,rows to comma separated values in mysql ,search comma separated values in mysql ,search in comma separated values in mysql ,select comma separated values in mysql ,select comma separated values in mysql php ,select rows as comma separated values in mysql ,separated values in mysql key ,separated values in mysql keys ,separated values in mysql value ,separated values in mysql version ,separated values in mysql zip ,separated values in mysql zoom ,split comma separated values in mysql ,split comma separated values in mysql stored procedure ,split comma separated values into rows in mysql ,store comma separated values in mysql ,update comma separated values in mysql

table_data

And You want to match code column using   MySql. But You only want to match the Value before A Specific Separator (For Ex. ‘BIGOTHA’,’ADSIRO’ in This “promo_code” Table )

How to Separated Values of Single Colum and Match Them in MySql

So The Only Thing You Have to do is to Explode Our Column Value with a Specific Separator.For This We Will Use  SUBSTRING_INDEX in our mysql Query.

Now I am going to show you how you can explode or split single column value and match them  using SUBSTRING_INDEX

SUBSTRING_INDEX() function :

MySQL SUBSTRING_INDEX() returns the sub string from the given string before a specified number of occurrences of a delimiter.

The substring returned from the left of the final delimiter when the specified number is a positive number and from the right of the final delimiter when the specified number is a negative number.

If the specified number is greater than the number of occurrence of delimiter, the returned substring will be the total string. If the specified number is 0, nothing will be fetched from the given string.

Syntax :

SUBSTRING_INDEX(str, delim, count)

Argument :

NameDescription
strA string.
delimA delimiter.
countAn integer indicating the number of occurrences of delim.

MySql Query :

 

SELECT * from promo_code where  SUBSTRING_INDEX(code, '-', 1)='BIGOTHA' ;

 

This Above query Will return this Output :

table-data-3

So as you can see this above mysql query will use "-" as separator and divide all the column value in two Parts ( For Ex. “BIGOTHA” and “000” ).After That it will Match Only BIGOTHA  string in all columns and return the matched result.

Hope it will Help You and please like my facebook page :

and make me proud.By the way if you face any problem then let me know in comment section below

6 Comments

  1. Ahaa, its fastidious dialogue about this post at this
    place at this website, I have read all that, so now me also commenting at this place.

  2. Hey just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading correctly.
    I’m not sure why but I think its a linking issue.
    I’ve tried it in two different web browsers and both show the same outcome.

  3. Hello admin !! I read your content everyday and i must say you have hi quality content here.
    Your page deserves to go viral. You need initial boost only.
    How to go viral fast? Search for; forbesden’s tools

  4. Wow, that’s what I was exploring for, what a material! existing here at this webpage, thanks admin of this web site.

  5. Pingback: Google

Leave a Reply

Your email address will not be published. Required fields are marked *