Hey there! I have a varchar which has urls in it, separated by a comma. Example: http://www.test.com/imga1.php, http://www.test.com/imga2.php, etc I need to remove everything what's after the first comma. I need only one image url left, the first one. How can I do that? Thanks!
ehh... I would have trial and error a few things on that one but think charindex... something like this perhaps.. http://stackoverflow.com/questions/17345880/how-to-trim-everything-after-certain-character-in-sql hope that helps, Nigel
If you are using php $string = 'http://www.test.com/imga1.php, http://www.test.com/imga2.php'; $string_arr = explode(','. $string ); $first = $string_arr[0]; Not sure why you want to do this in mysql or storing data like that in mysql...