More information about the Underscore mailing list

[_] SQL gurus - create user name from first and last name

Tim Beadle tim.beadle at gmail.com
Thu Oct 18 15:52:00 BST 2007

On 18/10/2007, Rick Hurst <rick.hurst at gmail.com> wrote:
> ok usually I would use php or asp to achive this, but there must be a
> way of doing it with just sql (currently Access but can easily be
> exported to mysql).  I want to create usernames for users in a table
> ("people") from the first letter of a first_name column and the
> last_name joined. For bonus points, also needs to remove any spaces
> and lowercase everything.

In postgres, I would use the || (concatenate) operator, with the
substr and trim functions. No idea how many of those apply in other
RDBMS environments.

Tim