> Hello all, is it possible to select only a certain > number of characters from a field when running a query > in MySQL? For example I would like to select the > password and then the first 6 characters of the > username in the username field (which is of type > varchar). Thanks in advance!
You want to use the SUBSTRING function. E.g. SELECT password, SUBSTRING(username, 1, 6) FROM my_table WHERE ... See the MySQL manual for more info: http://www.mysql.com/doc/en/String_functions.html Thanks, Colin Anderson [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php