2

My question related to MySQL ,

how to set data which is result from where condition

for example , in tbl_user there is status column now i want to update status column with starting letter current existing word in status column

existing data

tbl_user

useid | status
sam      Active
jam      Inactive

what i want after updating

useid | status
sam      A
jam      I

Thanks in advance

sameiksha
  • 25
  • 5

2 Answers2

1

You can try below - left(status,1) will give you the first character of your status field

update tbl_user set status=left(status,1)
Fahmi
  • 37,315
  • 5
  • 22
  • 31
0

You seem to want to keep only the first letter of the status field, which you can achieve with the left() function:

update tbl_user set status=left(status,1)
Shadow
  • 33,525
  • 10
  • 51
  • 64