Answered by:
SQL Query help need

Question
-
Answers
-
Can you please elaborate it a little bit more? what is known manager, is it same department with same manager in different Location? Please post with some data and the result set you want.
Cheers,
Amit Tomar
---------------------------------------------------
Please mark this as answer if it solved your query
Please vote this as helpful if it solved your query
---------------------------------------------------
My Blog My Wiki Page- Marked as answer by Text1234 Tuesday, November 17, 2015 6:25 PM
Tuesday, November 17, 2015 1:58 AM
All replies
-
;with cteKnownLocations as (select Location_Id from Departments where Manager_ID = @KnownManagerId)
select * from Departments D where D.Department_Name like '%ing' and Location_ID not in (select location_id from cteKnownLocations)
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articlesMonday, November 16, 2015 7:22 PM -
I do not understand what output you would like. What do you mean by 'known manager'? Do you want the departments to have the same, known, manager? I.e. the MANAGER_ID is an input variable. Can the managers be different, meaning there are two input variables?
Can there be more than one 'Accounting' department with different locations?
Also, I fail to see what use it is to find pairs of departmenst ending in -ing, but that might be my limited imagination.
Monday, November 16, 2015 8:29 PM -
This is clearly an interview question and the OP is trying to solve it with the forum's help.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articlesMonday, November 16, 2015 8:32 PM -
Can you please elaborate it a little bit more? what is known manager, is it same department with same manager in different Location? Please post with some data and the result set you want.
Cheers,
Amit Tomar
---------------------------------------------------
Please mark this as answer if it solved your query
Please vote this as helpful if it solved your query
---------------------------------------------------
My Blog My Wiki Page- Marked as answer by Text1234 Tuesday, November 17, 2015 6:25 PM
Tuesday, November 17, 2015 1:58 AM -
What according to you represents known manager?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page- Proposed as answer by Natig Gurbanov Tuesday, November 17, 2015 7:10 PM
Tuesday, November 17, 2015 3:59 AM -
This is clearly an interview question and the OP is trying to solve it with the forum's help.
I think he is cheating on his homework and needs to be expelled. Anyone want to track him to his school?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL
- Proposed as answer by Natig Gurbanov Tuesday, November 17, 2015 7:10 PM
Tuesday, November 17, 2015 4:04 AM