modify table data

Joined
Sep 26, 2012
Messages
6
Reaction score
0
In mysql i have table called user. And it contains data like
user
xyz.abc
123.abc
atr.abc etc.....
I need a query such that output should not contain the names after dot(.)
 
Joined
Oct 23, 2012
Messages
29
Reaction score
0
if you're using SQL Program, i think you mean "MySQL" then you can use the function "CharIndex"

the statment should be something like this

"Select Substring(ColumnName,0,CharIndex('.',ColumnName)) as NewUserID From TableName"

0 is Start Index
CharIndex will Return the index number for the '.' and it will be the same the supposed length for the string without the .abc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top