How to get result in following scenario

Swapnil Kadam

I have table

EMP(id int primary key, name varchar2(15), mgrID int).

Now this table contain all employees(including worker and manager) in company. mgrID column contain id of employee to whom they are reporting.

I want to list the name of worker who is not manager along with their name of manager. What to do for such query.

I tried nested select query as follows:

select name, (select name from EMP where mgerID is NULL) 
as Manager from EMP;

Will this query give proper result?

Mureinik

You could use a self-join:

SELECT e.name AS name, m.name AS manager_name
FROM   emp e
JOIN   emp m ON e.mgrid = m.id

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to implement autocomplete functionality using PHP, jQuery and AJAX in following scenario?

From Dev

How to create an inner array inside parent array in following scenario?

From Dev

How to manipulate the array in following scenario?

From Dev

How to use threading or Task pattern in following scenario

From Dev

How to change the array in following scenario?

From Dev

How to use create event on a jQuery dialog in following scenario?

From Dev

How to split and concatenate the string to get the following result using jquery

From Dev

How to print associative array data in a Smarty template in following scenario?

From Dev

How would I improve the performance in the following scenario

From Dev

How to use expandable list view in the following scenario

From Dev

How to click a parent element using the child element for the following scenario

From Dev

SQL How to join two tables to get records in following scenario?

From Dev

How to use RethinkDB indices in the following scenario?

From Dev

How to assign unique id to each select box for the following scenario

From Dev

How to restart serenity scenario at failure and get success in the report in case of success result

From Dev

How to show the groupwise result for the following scenario?

From Dev

How to call a jQuery function on click event in the following scenario?

From Dev

How to make the checkbox working properly in following scenario?

From Dev

how to make a left outer join in following scenario

From Dev

How to use threading or Task pattern in following scenario

From Dev

How to split and concatenate the string to get the following result using jquery

From Dev

How to get result in following scenario

From Dev

MySQL Join Query { How to get following Result }

From Dev

following scenario: why all the data did not get copied into the table?

From Dev

How to join two tables to get the following result?

From Dev

How to avoid duplicates in following SQL scenario

From Dev

How to apply conditional aggregation in SQL the following scenario?

From Dev

How to apply If condition for following result?

From Dev

How to deal with following scenario in QTP?

Related Related

  1. 1

    How to implement autocomplete functionality using PHP, jQuery and AJAX in following scenario?

  2. 2

    How to create an inner array inside parent array in following scenario?

  3. 3

    How to manipulate the array in following scenario?

  4. 4

    How to use threading or Task pattern in following scenario

  5. 5

    How to change the array in following scenario?

  6. 6

    How to use create event on a jQuery dialog in following scenario?

  7. 7

    How to split and concatenate the string to get the following result using jquery

  8. 8

    How to print associative array data in a Smarty template in following scenario?

  9. 9

    How would I improve the performance in the following scenario

  10. 10

    How to use expandable list view in the following scenario

  11. 11

    How to click a parent element using the child element for the following scenario

  12. 12

    SQL How to join two tables to get records in following scenario?

  13. 13

    How to use RethinkDB indices in the following scenario?

  14. 14

    How to assign unique id to each select box for the following scenario

  15. 15

    How to restart serenity scenario at failure and get success in the report in case of success result

  16. 16

    How to show the groupwise result for the following scenario?

  17. 17

    How to call a jQuery function on click event in the following scenario?

  18. 18

    How to make the checkbox working properly in following scenario?

  19. 19

    how to make a left outer join in following scenario

  20. 20

    How to use threading or Task pattern in following scenario

  21. 21

    How to split and concatenate the string to get the following result using jquery

  22. 22

    How to get result in following scenario

  23. 23

    MySQL Join Query { How to get following Result }

  24. 24

    following scenario: why all the data did not get copied into the table?

  25. 25

    How to join two tables to get the following result?

  26. 26

    How to avoid duplicates in following SQL scenario

  27. 27

    How to apply conditional aggregation in SQL the following scenario?

  28. 28

    How to apply If condition for following result?

  29. 29

    How to deal with following scenario in QTP?

HotTag

Archive