Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL database

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
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 backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

856 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