Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining tables

Status
Not open for further replies.

peekay

Programmer
Oct 11, 1999
324
ZA
My problem is similar to another question (SQL problems.. ) but I cannot find the solution directly from those replies.
I have a table named Jobs which has a JobNumber and a Closed field. I also have another table named JobItems which contains the job items for the jobs in the first table. This table also has JobNo and Done fields.
I need to find out which job items in the JobItems table has their field done=false for which their jobno in the Jobs table has the field closed=false.
I read that I have to join the tables and have come as far as the following SQL statement :
"Select * from JobItems,Closed from Jobs INNER JOIN JobItems ON JobItems.JobNo=Jobs.JobNo where JobItems.done=false and Jobs.closed=false"
It does not give an error but neither does it give me any records in the recordset whilst I know there should be records.
Can somebody please help me.

PK Odendaal
pko@mweb.co.za

 
SELECT JobItems.*, Jobs.Closed FROM JobItems INNER JOIN Jobs ON JobItems.JobNo = Jobs.JobNumber WHERE JobItems.Done = False AND Jobs.Closed = False

(not tested)

Simon
 
Simon - thanks for the help - I got it to work properly.


PK Odendaal
pko@mweb.co.za

 
Just as you have written
Thanks again.

PK Odendaal
pko@mweb.co.za

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top