Solved

SQL database

Posted on 2013-01-10
3
371 Views
Last Modified: 2013-01-10
I need to know how to select the  first time, Second time and Third time PO approval employee name. when I tred as below , but output  show EmployeeID  only.

Can you please help ……….. please see attached image

SELECT     tbl_PoAproval.FistAproval, tbl_PoAproval.FistAprovalDate, tbl_PoAproval.SecondAproval, tbl_PoAproval.SecondAprovalDate, tbl_PoAproval.ThirdAprovalDate,

                      tbl_PoAproval.ThirdAproval, tbl_PoAproval.PONumber, Employees.FirstName

FROM         tbl_PoAproval INNER JOIN

                      Employees ON tbl_PoAproval.FistAproval = Employees.EmployeeID

WHERE     (tbl_PoAproval.PONumber = 'WA-011075')
image001.png
0
Comment
Question by:upalakshitha
3 Comments
 
LVL 1

Accepted Solution

by:
tissier earned 250 total points
ID: 38762203
Hi,

I didn't check, but try this :
SELECT     tbl_PoAproval.FistAproval, tbl_PoAproval.FistAprovalDate, tbl_PoAproval.SecondAproval, tbl_PoAproval.SecondAprovalDate, tbl_PoAproval.ThirdAprovalDate,
tbl_PoAproval.ThirdAproval, tbl_PoAproval.PONumber, 
FirstApprovalEmployee.FirstName,
SecondApprovalEmployee.FirstName,
ThirdApprovalEmployee.FirstName

FROM         tbl_PoAproval INNER JOIN
    Employees as FirstApprovalEmployee ON tbl_PoAproval.FistAproval = FirstApprovalEmployee.EmployeeID
INNER JOIN
    Employees as SecondApprovalEmployee ON tbl_PoAproval.SecondAproval = SecondApprovalEmployee.EmployeeID
INNER JOIN
    Employees as ThirdApprovalEmployee ON tbl_PoAproval.ThirdAproval = ThirdApprovalEmployee.EmployeeID

WHERE     (tbl_PoAproval.PONumber = 'WA-011075')

Open in new window

0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 total points
ID: 38762251
correct

YOu need to join the same table again 3 times , Just changing naming convetions to better understand

SELECT     tbl_PoAproval.FistAproval, tbl_PoAproval.FistAprovalDate, tbl_PoAproval.SecondAproval, tbl_PoAproval.SecondAprovalDate, tbl_PoAproval.ThirdAprovalDate,
tbl_PoAproval.ThirdAproval, tbl_PoAproval.PONumber,
FirstApprovalEmployee.FirstName as First_Approver,
SecondApprovalEmployee.FirstName as Second_approvar,
ThirdApprovalEmployee.FirstName as Third_approvar

FROM         tbl_PoAproval INNER JOIN
    Employees as FirstApprovalEmployee ON tbl_PoAproval.FistAproval = FirstApprovalEmployee.EmployeeID
INNER JOIN
    Employees as SecondApprovalEmployee ON tbl_PoAproval.SecondAproval = SecondApprovalEmployee.EmployeeID
INNER JOIN
    Employees as ThirdApprovalEmployee ON tbl_PoAproval.ThirdAproval = ThirdApprovalEmployee.EmployeeID

WHERE     (tbl_PoAproval.PONumber = 'WA-011075')
0
 
LVL 13

Author Closing Comment

by:upalakshitha
ID: 38762378
Thank you...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now