You can self-join the table to get the manager’s name from his ID:
SELECT e.employee_name, m.employee_name AS manager_name FROM employee e JOIN employee m on e.manager_id = m.employee_id
Related Posts:
- SQL update from one Table to another based on a ID match
- Inserting multiple rows in a single SQL query? [duplicate]
- How do I UPDATE from a SELECT in SQL Server?
- T-SQL split string
- The SQL OVER() clause – when and why is it useful?
- Update multiple columns in SQL
- SQL Server IF EXISTS THEN 1 ELSE 2
- SQL Query with SUM with Group By
- How do I perform an IF…THEN in an SQL SELECT?
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- How to drop all tables from a database with one SQL query?
- SQL Server : Arithmetic overflow error converting expression to data type int
- How to calculate percentage with a SQL statement
- Query comparing dates in SQL
- Best way to do nested case statement logic in SQL Server
- What is the meaning of the prefix N in T-SQL statements and when should I use it?
- Query error with ambiguous column name in SQL
- How to drop all tables from a database with one SQL query?
- How to find sum of multiple columns in a table in SQL Server 2005?
- How can I delete using INNER JOIN with SQL Server?
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- CREATE TABLE IF NOT EXISTS equivalent in SQL Server
- How to group by month from Date field using sql
- How can I get column names from a table in SQL Server?
- Is there a combination of “LIKE” and “IN” in SQL?
- Search text in stored procedure in SQL Server
- How to format a numeric column as phone number in SQL
- SQL – WHERE (X, Y) IN (A, B)
- sql query to return differences between two tables
- SQL: IF clause within WHERE clause
- How to select the last record of a table in SQL?
- SQL- Ignore case while searching for a string
- Using Excel VBA to run SQL query
- What is tableName.* in SQL
- What do Clustered and Non-Clustered index actually mean?
- Conversion failed when converting date and/or time from character string while inserting datetime
- SQL query to select dates between two dates
- SQL SELECT WHERE field contains words
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- NOT IN vs NOT EXISTS
- SQL SELECT WHERE field contains words
- Efficiently convert rows to columns in sql server
- How to delete duplicate rows in SQL Server?
- Nested select statement in SQL Server
- How do I escape a single quote in SQL Server?
- T-SQL split string based on delimiter
- Column name or number of supplied values does not match table definition
- Inserting data into a temporary table
- CREATE VIEW must be the only statement in the batch
- SQL Server FOR EACH Loop
- Difference between JOIN and INNER JOIN
- The target principal name is incorrect. Cannot generate SSPI context
- The EXECUTE permission was denied on the object ‘xxxxxxx’, database ‘zzzzzzz’, schema ‘dbo’
- BCP error “Unable to open BCP host data-file”
- “CASE” statement within “WHERE” clause in SQL Server 2008
- What is the difference between Scope_Identity(), Identity(), @@Identity, and Ident_Current()?
- Conversion failed when converting from a character string to uniqueidentifier – Two GUIDs
- Operand type clash: int is incompatible with date + The INSERT statement conflicted with the FOREIGN KEY constraint
- Keeping it simple and how to do multiple CTE in a query
- DateTime2 vs DateTime in SQL Server
- Difference between numeric, float and decimal in SQL Server
- SQL Server Insert if not exists
- SQL Server: Invalid Column Name
- sql server invalid object name – but tables are listed in SSMS tables list
- How to get a date in YYYY-MM-DD format from a TSQL datetime field?
- What is the equivalent of ‘describe table’ in SQL Server?
- How do I query for all dates greater than a certain date in SQL Server?
- String or binary data would be truncated. The statement has been terminated
- Add a column with a default value to an existing table in SQL Server
- Error converting data type varchar to float
- How to concatenate text from multiple rows into a single text string in SQL Server
- Count(*) vs Count(1) – SQL Server
- ClassNotFoundException – com.microsoft.jdbc.sqlserver.SQLServerDriver
- The SELECT permission was denied on the object ‘Users’, database ‘XXX’, schema ‘dbo’
- How do you open an SDF file (SQL Server Compact Edition)?
- Using RegEx in SQL Server
- Conversion failed when converting the varchar value ‘simple, ‘ to data type int
- How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?
- Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”
- Bulk load data conversion error (truncation)
- Difference between database and schema
- ‘Microsoft.ACE.OLEDB.16.0’ provider is not registered on the local machine.
- SQL: Two select statements in one query
- SQL Server Linked Server Example Query
- How do I format a number with commas in T-SQL?
- SQL datetime compare
- SQL Server dynamic PIVOT query?
- Incorrect syntax near ”
- SQL Server “cannot perform an aggregate function on an expression containing an aggregate or a subquery”, but Sybase can
- To add server using sp_addlinkedserver
- Get everything after and before certain character in SQL Server
- How to connect to a local database in SQL Server Management Studio?
- DATEDIFF function in Oracle
- What are named pipes?
- Comma separated results in SQL
- INSERT VALUES WHERE NOT EXISTS
- How to implement LIMIT with SQL Server? [duplicate]
- Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF
- Help me SELECT thumbnail from SQL and use
- Database SQL query error