Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
-
Contact:
Post
by pelegk2 »
i havee this select :
Code: Select all
select * from orangedelivery where region=106
in this orangedelivery table i have a col with the workes number!
in another table i have the workers id and there full name
how can i in the above select to get the worker's name?
thnaks in advance
peleg
-
Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 »
Might try something like this:
Code: Select all
SELECT * FROM orangedelivery AS orange, othertable AS other WHERE orange.region=106 AND orange.workers_number = other.workers_id
Provided all orange worker_number have a corresponding other worker_id. If not then an outer join maybe needed.
Code: Select all
SELECT * FROM orangedelivery AS orange LEFT JOIN othertable AS other ON orange.workers_number = other.workers_id WHERE orange.region=106
Hope that helps.
-
pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
-
Contact:
Post
by pelegk2 »
10X:) alot i will try it