Solved

SQL database

Posted on 2013-01-10
3
370 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

758 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

20 Experts available now in Live!

Get 1:1 Help Now