Click here to Skip to main content
15,884,838 members
Home / Discussions / Database
   

Database

 
Questionreturn the results from Query union the external proc in DB2 Pin
sudevsu30-Sep-15 8:49
sudevsu30-Sep-15 8:49 
QuestionDatabase relationship for tables Pin
maugonza30-Sep-15 8:43
maugonza30-Sep-15 8:43 
AnswerRe: Database relationship for tables Pin
Jörgen Andersson1-Oct-15 2:12
professionalJörgen Andersson1-Oct-15 2:12 
SuggestionRe: Database relationship for tables Pin
Nathan Minier1-Oct-15 7:15
professionalNathan Minier1-Oct-15 7:15 
QuestionMSaccess query to access random value from database Pin
Member 1202314130-Sep-15 4:50
Member 1202314130-Sep-15 4:50 
QuestionMusic Database Pin
morrism3530-Sep-15 2:30
morrism3530-Sep-15 2:30 
AnswerRe: Music Database Pin
Richard MacCutchan30-Sep-15 3:05
mveRichard MacCutchan30-Sep-15 3:05 
QuestionQuery is not producing the correct results(SOLVED) Pin
samflex28-Sep-15 5:45
samflex28-Sep-15 5:45 
Hello experts,

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:

EmpName,

EmpID

Dept

Division

Password

SSN

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.

Your assistance is greatly appreciated.

modified 29-Sep-15 10:27am.

AnswerRe: Query is not producing the correct results Pin
Richard Deeming28-Sep-15 6:22
mveRichard Deeming28-Sep-15 6:22 
GeneralRe: Query is not producing the correct results Pin
samflex28-Sep-15 7:32
samflex28-Sep-15 7:32 
QuestionMove GROUP_CONCAT's comma values to columns Pin
Jassim Rahma22-Sep-15 22:03
Jassim Rahma22-Sep-15 22:03 
Questionpostgresql database issues Pin
Member 1191972221-Sep-15 22:09
Member 1191972221-Sep-15 22:09 
AnswerRe: postgresql database issues Pin
Richard MacCutchan21-Sep-15 22:50
mveRichard MacCutchan21-Sep-15 22:50 
GeneralRe: postgresql database issues Pin
Member 1191972221-Sep-15 23:23
Member 1191972221-Sep-15 23:23 
GeneralRe: postgresql database issues Pin
Richard MacCutchan21-Sep-15 23:27
mveRichard MacCutchan21-Sep-15 23:27 
GeneralRe: postgresql database issues Pin
Member 1191972221-Sep-15 23:31
Member 1191972221-Sep-15 23:31 
GeneralRe: postgresql database issues Pin
Member 1191972221-Sep-15 23:34
Member 1191972221-Sep-15 23:34 
GeneralRe: postgresql database issues Pin
Richard MacCutchan21-Sep-15 23:52
mveRichard MacCutchan21-Sep-15 23:52 
GeneralRe: postgresql database issues Pin
Member 1191972221-Sep-15 23:56
Member 1191972221-Sep-15 23:56 
GeneralRe: postgresql database issues Pin
Richard MacCutchan22-Sep-15 0:00
mveRichard MacCutchan22-Sep-15 0:00 
GeneralRe: postgresql database issues Pin
Member 1191972222-Sep-15 0:04
Member 1191972222-Sep-15 0:04 
GeneralRe: postgresql database issues Pin
Richard MacCutchan22-Sep-15 0:29
mveRichard MacCutchan22-Sep-15 0:29 
GeneralRe: postgresql database issues Pin
Member 1191972222-Sep-15 0:49
Member 1191972222-Sep-15 0:49 
GeneralRe: postgresql database issues Pin
Richard MacCutchan22-Sep-15 20:57
mveRichard MacCutchan22-Sep-15 20:57 
GeneralRe: postgresql database issues Pin
Member 1191972222-Sep-15 21:05
Member 1191972222-Sep-15 21:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.