Skip to content
Advertisement

Query to replace ID with Name within the same table?

Can anyone help me figure out this SQL Query?

I have the following table:

I want the new table to look like this:

So essentially I want to replace the third column from “ManagerId” to “Manager Name,” where all information is retrieved in the same table.

Can anyone help me with the query?

I was thinking of something like the following, but it wasn’t even compiling:

I had another attempt, but got stumped quickly:

Advertisement

Answer

Just use a join:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement