Good evening all,
I have a strange situation which I cannot think myself out of. To make
it simple my db looks like this
(hr db, emp_master table)
+--------+---------------+
| emp_id | last_name |
+--------+---------------+
| 1 | smith |
| 3 | wesson |
| 4 | doe |
| 6 | clinton |
| 7 | bush |
+--------+---------------+
(tools db, orders table)
+--------+---------+---------+
| order_id | emp_id |approved_by |
+--------+---------+---------+
| 1 | 1 | 6 |
| 2 | 4 | 7 |
| 3 | 3 | 4 |
| 4 | 7 | 3 |
| 5 | 6 | 1 |
+--------+---------+---------+
I want my query results to be similiar to this:
if I'm selecting all, this is what I want:
1 smith clinton
2 doe bush
3 wesson doe
4 bush wesson
5 clinton smith
It seems so easy, but I've tried hard and cannot get it to work I've
been going along the lines (changed several times) of
Select tools.orders.order_id, hr.emp_master.last_name as ordered_by,
hr.emp_master.last_name as approved_by from tools.orders, hr.emp_master
where ((tools.orders.emp_id=hr.emp_master.emp_id) and
(tools.orders.approved_by=hr.emp_master.emp_id))
(I hope I wrote that right, it was freehand, not in db)
Thank you for any direction you can give me!
Dam