[Durham] SQL LEFT JOIN help...

Richard Patterson Richard at helpquick.co.uk
Sun Nov 21 21:29:12 UTC 2010


> SELECT o.id, o.order_ref, con.contact_surname, com.company_name
> FROM (
> 	orders o
> 	LEFT JOIN contacts con ON o.contact_id=con.id)
> LEFT JOIN companies com ON con.company_id = com.id;

Ok, I have just tried:

SELECT o.id, o.order_ref, con.contact_surname, com.company_name
FROM ((
	orders o
	LEFT JOIN contacts con ON o.contact_id=con.id)
		LEFT JOIN companies com ON con.company_id = com.id)
			LEFT JOIN addresses a ON o.address_id=a.id;

And that seems to do the trick... BUT is this the best way to do it?

Regards

Richard

Richard Patterson
Mobile: 07921 512 459


HelpQuick Ltd
The headquarters of
innovative IT solutions

Office: 0191 2582888, Fax: 0191 6408666
Web: http://www.helpquick.co.uk

Have you used our services? Why not write a review on the FreeIndex website

HelpQuick Limited, Registered in England & Wales, Company number
5334746, Vat registration number: 859 6133 89, Registered office:
18 Camden Square, North Shields, NE30 1NR, UK


_______________________________________________
Durham mailing list   -   Durham at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/durham
http://www.nelug.org.uk/



More information about the Durham mailing list