Skip to content
Advertisement

How to display the name of a supervisor for a certain worker MYSQL

Display the name of McLester’s supervisor. Using standard syntax

Here is the table I think I need to connect staffno and supervisorno. But it does not seem to work. Any Ideas why?

Here is a screenshot to the table https://prnt.sc/on3er7

ERROR 1052 (23000): Column ‘lastname’ in where clause is ambiguous

To replicate the problem:

Advertisement

Answer

Just use proper joins and column aliases:

See the demo.
Result:

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