Record is not displayed in query result

S

Steve S

select *
from a, b, c, d, e
where a.id = b.id
and a.id = c.id
and a.id = d.id
and a.id = e.id

PROBLEM: in the above, if a.id = d.id fails (no d.id exists for a.id)
NEEDED: I still want a record returned even though no record was found for
d.id.

How do I do this???
 
O

Ofer

You are creating a query in the old fashion way, in SQL Server we used to use
this way of sql to join tables.
Table1.Field1 = Table2.Field1 - To create a query today it called inner
join, this join will return only values that apear in both tables

Select ....
FROM Table1 INNER JOIN Table2 ON Table1.Field1 = Table2.Field1
==============================================

To include all the fields from table1 even if they are not apear in table2,
you need to use left or right join

FROM Table2 RIGHT JOIN Table1 ON Table2.Field1= Table1.Field1

==============================================

The easiest way will be to create the query, add the tables, create a join
between the tables by clicking on one field and draging it to the other filed
in the next table, then double click on the join, in the dialog box that open
select the join you would like.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top