Is it possible to edit the contents of fields after a select statemen? For example, I have a table Person (Id int, Username varchar(50)). Most of the rows in Username has the format of, say for example, aaa_01, bbb_02. I want to select this usernames with the underscores and the numeric parts ommited (Say for aaa_01, it will output aaa only). Is this possible in mysql?
select 'aaa_01' as st, left(st, locate ('_', st)-1) as shorter
-- st shorter
-- aaa_01 aaa
-- however, code not tested. you should look-up left and locate functions from mysql manual whether
-- the parameters are in correct sequence (mysql has its own notion on how to put the parameters in
-- Also this should work (parameters are in correct sequence now for instr() had been copied
-- from Oracle):
select 'aaa_01' as st, left(st, instr(st, '_')-1) as shorter
Hi, I am a newbie in developing a website. i have tried to connect using mysqli conncetion
Here is my simple code.
// db.php code
//$con = mysqli_connect("localhost","root","","bakery"); ...