I hope this question falls under the Database category.
I have this query:
Select e.Dept, e.division, a.managerID,e.EmpName,e.empnum, e.Email,e.zip, e.SSN FROM Emp e, Angular a Where e.empID = a.managerid OR e.empID = @empid and password=@pass
What I am attempting to do is that if a user attempts to log in and that user is a manager, redirect him/her to manager screen.
Otherwise, redirect to employee screen.
The issue is that when I run that query, I expect to see records associated with that manager.
It shows ALL employees belonging to different managers.
How do I tweak this to work?
A bit more info:
There are two tables, Emp table with following relevant attributes:
User logs in with EmpID as username and last digits of SSN as password
Then this other table called Angular with following relevant attributes:
EmpID - FK to EmpID from Emp table
ManagerID FK to EmpID from Emp table
Status (done or pending)
The logic we are trying to employ is that if empID (from Emp table) that the user is logging in with matches ManagerID (from Angular table) then this must be a manager, redirect him or her to manger page.
If empID from Emp table does not match managerID from Angular table, redirect to employee table.
What am I doing wrong?
The code for redirect is asp.net and no need to post it here because if the query is correct, that will work.
The best possible solution is to learn all about database management. It looks like (but this is a guess since your question is not clear) that you have changed the schema of your database and now some of your records do not match the schema.
its returning the dates greater than 2015-07-01 without any null rrecords for dt_bill_date column of sc_bill table but i want same record to be displayed for dt_open_date column of sc_bill_detail ...thats what my requirement actually
i am not writting any code its only a query which i need to write according to the requirement as i told u btw my approach of writting query is correct ?or any other way to get it...coz i think its the simplest one?