0

My question was to take the first letter of a survey responders first name and the first letter of the responders last name and concatenate the two so I get something along the lines of this: Sam Smith's would result in SS.

I'm using this query to do that and get the result I needed:

select concat(letterfirst, letterlast) as users
from (select substring(first_name,1,1) as letterfirst, 
             substring(last_name,1,1) as letterlast
       from survey_responders) as user1

Now I need to pass that result into the username column in the same table, survey_responders. I know I have to use a update statement but I can't seem to wrap my head around using a select statement with an update.

1 Answer 1

3

You are overcomplicating the situation:

update survey_responders
    set username = concat(left(first_name, 1), left(last_name, 1));
Sign up to request clarification or add additional context in comments.

1 Comment

You made that look way too easy. ugh! I've spent the last 2 hours trying to figure that out. Thank you! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.