SQL Join

6 views
Skip to first unread message

Dave

unread,
Mar 13, 2008, 2:19:41 AM3/13/08
to MapInfo-L
Hi.

I am wanting to do a SQL join between two tables. The two tables have
the same field but contain different information. One table is a
electoral voter table thus each record refers to an individual person.
The other table is a council table representing parcels within a
council area. As a parcel of land is often owned by more than one
person the name field in this table often has more than one person.

I am familiar with the SQL 'like' query where a part of a string can
be returned, eg:

Surname like "john%"

returns John, Johnston etc

I am also familar with spatial joins where I can join these two table
by Table1.Fullname = Table2.Fullname.

As Table1 (voter table) contains only a single person where as Table2
(cadastral table) can contain multiple names how do I create a SQL
spatial join between these two tables? The SQL query I am guessing
will be similiar to the 'Like' query I mentioned above.

Assistance would be appreciated.

Dave Markey
Corporate Applications Officer
Ipswich City Council
Ipswich, Qld
Australia

geomatics.ch

unread,
Apr 26, 2008, 7:49:01 PM4/26/08
to MapInfo-L
Hi,

Assuming, but not sure, if you would like to query the parcel table in
order to retrieve persons' names, and not the other way around.

If this is the case, here is one way to look at it:

Let's say ParcelGeo is your geographic table and OwnerData is tabular
data.

Select From: ParcelGeo, OwnerData
Where: ParcelGeo.id = OwnerData.parcelnumber

This would return a Queryn that would have something like

3546, Jonhson
3546, Smith
3548, May
3550, Marriott
3550, Shelley
3550, Oakley

If you save your File>Save *Query>"Save Table As Query" with a name
like JOIN_PARCEL_NAMES
you could have it for later use and it would be automatically updated
if the ParcelGeo or OwnerData get modified

Add JOIN_PARCEL_NAMES to a map window, and this method would allow you
to use the info tool on a parcel and get the names of all its owners
(A), and inversely search for a Name like "Ma%" and get all the
parcels whose owners start with these two letters (B).

(A)
3546, Johnson
3546, Smith
or
(B)
3548, May
3550, Marriott


Hope this helps

Archie

unread,
May 29, 2008, 12:49:16 AM5/29/08
to MapInfo-L
Hi Dave,

Is the Electoral Voter table a flat table (not mapped / no geographic
objects)?

Cheers,
Archie
Reply all
Reply to author
Forward
0 new messages