[Wolves] Mysql join help

David Goodwin david at codepoets.co.uk
Fri Jun 28 12:37:41 UTC 2013


On 28 Jun 2013, at 13:25, Wayne Morris <waynelists at machx.co.uk> wrote:

> Hi,
> can someone point me to a simple tutorial on joining two tables - can't seem to grasp it - or point out how I get what I want from this.
> 
> Got a table called property and a table from repairs and i'm quite competant and selecting and displaying from one table at a time.
> Table are related by property.id being inserted into repairs.pid
> However I seem incapable of creating a list containing field of both tables eg I want
> SELECT from (address details) from property where (stuff in repairs list unfixed)
> to show
> 14 Town Street  - repair window - date reported
> 14 town street - fix door - date reported
> 23 smith street - broken heater - date reported


Something like the following, presumably ? :

SELECT property.address1, property.address2, repair.date_reported FROM property, repair WHERE property.id = repair.pid;

(that's an INNER JOIN).

See also :

http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins

Perhaps the venn diagram towards the bottom will help.


David.





More information about the Wolves mailing list