Click here to Skip to main content
15,891,762 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
I have three tables in the DB , These are EMP_MASTER MBO_MASTER and REPORTING_MASTER,
all these table having EMP_NO as a common field, I want to display all the data of EMP_MASTER for EMP_ID='4000004' on
the basis of MBO_MASTER field MBORQ_ID is equal to 2  for EMP_ID='4000004' and Whose SUP_ID is '12121212' in REPORTING_MASTER
Posted
Updated 1-Apr-14 20:49pm
v2
Comments
Tom Marvolo Riddle 2-Apr-14 2:29am    
Try this:
select * from Emp_master as a inner join MBO_master as b on a.emp_no = b.emp_no inner join reporting_master as c on on a.emp_no = c.emp_no where a.EMP_ID=4000004 and b.MBORQ_ID =2 and c.sup_id =12121212
Tom Marvolo Riddle 2-Apr-14 2:31am    
Try it & let me know
Ni!E$H_WAGH 2-Apr-14 2:42am    
No it is not working
Tom Marvolo Riddle 2-Apr-14 2:43am    
"Not working" - elaborate or post table structures with example records
Ni!E$H_WAGH 2-Apr-14 2:46am    
Ohh I am Sorry its my mistake ,it worked Thanks a lot . I took wrong MBORQ_ID .. Thanks again

Try this:
SQL
select * from Emp_master as a inner join MBO_master as b on a.emp_no = b.emp_no inner join reporting_master as c on on a.emp_no = c.emp_no where a.EMP_ID=4000004 and b.MBORQ_ID =2 and c.sup_id =12121212
 
Share this answer
 
v3
Try:
SQL
SELECT 
FROM Emp_Master e
JOIN Mbo_Master m 
    ON e.Emp_No=m.Emp_No
JOIN Reporting_Master r 
    ON e.Emp_No=r.Emp_No
WHERE m.EBORQ_ID=2 AND e.EMP_ID='4000004' AND r.SUP_ID='12121212'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900