3

We need to get the row, which has value in cmts greater than given value(4000), below is our example table structure

id cmts 1 1000,2000,3000,4000 2 1100,2200,3300,4400

Output should be the 2nd row(ID 2).

luchaninov
  • 6,792
  • 6
  • 60
  • 75
Mohammed Nagoor
  • 884
  • 2
  • 12
  • 25
  • Does the cmts filed always contains comma separated sorted values? if yes just get index of last comma, get substring for the last number, convert the number and compare with 4000. If it's bigger the row must be included into the results – StanislavL Mar 30 '16 at 08:20
  • http://stackoverflow.com/questions/17308669/reverse-group-concat-in-mysql – Reversal Mar 30 '16 at 08:50
  • @StanislavL, Yes the cmts field will always separated by comma – Mohammed Nagoor Mar 30 '16 at 09:10
  • [What have you tried?](http://mattgemmell.com/what-have-you-tried/) And [ask] <- Do read it pls. Or how much do you plan to pay to do your job? – Pred Mar 30 '16 at 11:00

1 Answers1

0
SELECT *
FROM cmts
WHERE CONVERT(SUBSTR(cmts, SUBSTRING_INDEX(cmts,',',-1), LEN(cmts)), ,UNSIGNED INTEGER)>4000
StanislavL
  • 56,971
  • 9
  • 68
  • 98