I have three tables: customers, salesorders and invoices. Customers have salesorders and salesorders have invoices ( child tables have foreign key columns to their parent).
I want to get a list of all invoices with their customers. This what I came up with: select invoices.objectid, invoices.invoicenumber, invoices.invoicedate, (select customer from salesorders where objectid = invoices.salesorderobjectid), (select customernumber from customers where objectid = (select customer from salesorders where objectid = invoices.salesorderobjectid)), (select lastname from customers where objectid = (select customer from salesorders where objectid = invoices.salesorderobjectid)) from invoices Can I do this smarter as the three subselects select the same customer three times and I would think that 1 time is enough? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster