Doubt related with sql query

Posted by Amritha444 under Sql Server on 5/19/2012 | Points: 10 | Views : 1153 | Status : [Member] | Replies : 2
<blockquote class="FQ"><div class="FQA">Quote:</div>Hi All

I want sqlquery for following requirement

I have 2 tables 'EMPLOYEE' and "EMP_REPORTING' each employee have reporting person.Reporting person will be another employee.

If Amrutha Reporting to Anisha
Anisha reporing to Janisha
Janisha reporting to Arjun

when amrutha login she needs to access her own details
when anisha login she can access amrutha's and anishas
when Janisha login she can access amrutha's, anishas and janisha's
when arjun login she can access amrutha's, anishas and janisha's and arjuns

Employee table fields are Emp_ID,Emp_Name
Reporting table consist of fields rep_id,emp_id.rep_emp_id

i want to get empids of all employees who reporting to login employee and also employees reporting to
employee under him

Thanks in Advance
Amrutha
</blockquote>




Responses

Posted by: Sekar.C on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
Hi amrutha,
First you set access limet to users based on Empid then Create views.


Regards
Sekar.c

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 5/21/2012 [Member] Starter | Points: 25

Up
0
Down
if you need hierarchy of employee,
it is done by recursive query in sql
here is link to understand recursive query :

http://ajaypatelfromsanthal.blogspot.in/2012/04/recursive-query-in-sql-server.html

Ajay
ajaypatelfromsanthal.blogspot.in

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response