Raj
Raj

Reputation: 11

How to change the names from table in mysql

I have table called user. And it contains names like

     user
   xyz.abc
   123.abc
   atr.abc
   etc.....     

I need a query such that output should not contain the names after dot(.)

Upvotes: 0

Views: 84

Answers (2)

Ertunç
Ertunç

Reputation: 829

select rtrim(username,'.') from user 

Upvotes: 0

Habibillah
Habibillah

Reputation: 28685

You can use SUBSTRING_INDEX

SELECT SUBSTRING_INDEX(name, '.', 1) from USER;

Upvotes: 4

Related Questions