View Single Post
Old October 27th, 2004, 04:12 AM
tsimsha tsimsha is offline
Authorized User
Join Date: Aug 2004
Location: , , .
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Qry to retrieve from 2 tables and display


   I have two tables.
spindex(PK autonumber) job_code layno yd wd

subindex(PK Autonumber) spindex(FK) rollno batchno weight color

I want to retrieve data from 2 tables by giving job_code and layno.
I used this query.

select job_code,layno,yd,wd,rollno,batchno,weight,color from table1,table2 where table1.job_code='04A001' and table1.layno=1 and table2.spindex=table1.spindex

It works fine when both tables have data.
If table1 has data and table2 dont have related data, its not retrieving any data. I want to show data from table1 eventhough table2 dont have data. What could be the query?

Finally i want to display in HTML table. Table1 data in header section and table2 data in body section.

Thanx in advance