-3

i want to find if there are any middle initial in first name column and manually remove them. How do I write the query and get it?

3
  • 2
    Do you have any examples? My first thought is to ignore everything after the last space, but I have no idea what your requirements or data looks like Jul 28, 2015 at 2:38
  • 2
    First off all, not clear by your tags what database engine you are using..second we dont know what your column names/table names are...third, we are not here to do work for you...Try to write the query yourself and then come back when you have an issue...
    – BK435
    Jul 28, 2015 at 2:38
  • 2
    This is very low-quality question. To avoid closing it, provide more information about the language you are using (plsql and mysql are totally different things), the data structure you are trying to query, as well as your previous attempts
    – Hawk
    Jul 28, 2015 at 2:39

1 Answer 1

0

If you want to do it in php, I would use a foreach loop and then execute the following code:

$string_array = explode(" ",$string)
$string = $string_array[0];

a) separate the string into x components

b) redefine the string to include only the first component

1
  • If you have the full name, use: $string = $string_array[0]." ".$string_array[count($string_array)] to include the first and last component, plus a space in the middle.
    – g35232t54
    Jul 28, 2015 at 2:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.