The table name is Employee
, here is the table below, I need to switch the departments so that John
is purchasing
and Jenn
is accounting
, but in a single query
EmpID | EmpName | Department |
---|---|---|
1 | John | Accounting |
2 | Jenn | Purchasing |
I have tried a few things but I can’t seem to find out to do in a single query
2
Answers
You can SELF JOIN employee table, where employee ID is not equal to each other.
Example Fiddle
Output
You know marked data literally, so use simple