December 16, 2006 at 6:37 am
Hello All,
This might seem like a silly question but I was wondering what the "best practice" was when I have a PARENT - CHILD - GRANDCHILD scenario and I'm LEFT JOINing the CHILD should I also LEFT JOIN the GRANDHCILD even if I don't need to. For instance say I have Customer, Invoice, LineItem. Customer may not have invoices but every invoice has line item. Say I want to get list of all customer in 'GA', along with invoice totals. Should my JOIN be like
SELECT
FROM CUSTOMER
LEFT JOIN INVOICE
LEFT JOIN LINEITEM
or can I do
SELECT
FROM CUSTOMER
LEFT JOIN INVOICE
JOIN LINEITEM
Since I know that all invoice will have a line item. FWIW, I currently do a LEFT JOIN, just starting to quetion if I have too. In testing I have been getting the same results
Thanks
Steve
Steve Dingle
December 16, 2006 at 8:23 am
nr 2.
You can use the inner join. The results for invoice,lineitem will be null if no matching customer is found.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply