how to break a field into two in SQL
By Randy Clark on May. 06, 2008
Please provide more detail. Do you mean read the value and then manipulate it in some way? What is the type of the field?
By Joe Mendis on May. 06, 2008
You probably are looking for substring operation on the strings. For example if you have a field 'ssn' from table customer that returns a Social Security Number in the form 123-45-6789 and you want the first three and last four digits:
mysql> SELECT SUBSTRING(ssn,0,3) as first3, SUBSTRING(ssn,7,4) as last4 FROM customer;
Check out the following for more in depth directions: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
Answers
Add AnswerShare your knowledge