rgb192
asked on
select a varchar row and display only the first 3 characters
input
12345
abcde
output
123
abc
12345
abcde
output
123
abc
Do you want to use PHP or want to do in mysql itself?
Using PHP try like this,
<?php
$myStr='12345';
$result = substr($myStr, 0, 3);
echo $result;
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try to do it with SQL substring() function. So that it selects only 3 char from the varchar column.
ASKER
This was the easiest code to use.
Thanks.
Thanks.