0

Updated Question : I have the below data ,When i query for column consists "999" , I need to get last row details. Can you please guide me on this.

find_in_set not working for the array data like below. find_in_set("999" , column)

Table : enter image description here

How do i get the last column when i query for column = 999 Dont want to use LIKE here , because I need to match for exact values

7
  • Have you tried removing the the square braces [ and ] from the column before you do find_in_set("999", column)? Commented Aug 4, 2017 at 1:22
  • i dont want to modify the data in database. do you mean after fetching the data to remove braces? Commented Aug 4, 2017 at 1:24
  • Yes also you need to remove " from the column values, it should be just 12345,999. This can be done in the query level , you don't need modify the data in table Commented Aug 4, 2017 at 1:29
  • You seemed very confused about SQL. Can you update your question to show us an exact sample of data you want to match along with which of those rows should appear in the output? Commented Aug 4, 2017 at 1:32
  • @dishanm find_in_set just gives you the position of the string you are searching for. My answer below is based on what you have asked. Commented Aug 4, 2017 at 1:34

1 Answer 1

1

I have created a SQLFiddle to write and refine your query. Here is the working sample of the same:

http://sqlfiddle.com/#!9/bc3f4/4

It is just a sample, which has same data as you have in your table. Modify and play with it.

Sign up to request clarification or add additional context in comments.

1 Comment

Update the Fiddle link in my answer... You can see what you want. Also please mark as answer if it was helpful to you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.