Solved

SQL database

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

777 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