Working with Sources

The old version of our genealogy database program.

Moderator: Nick Hunter

Locked
donne
Posts: 80
Joined: Wed Dec 28, 2005 12:46 pm
Location: UK
Contact:

Working with Sources

Post by donne » Mon Apr 16, 2007 11:18 am

I'm trying to organise better my references to Sources and Repositories which tended to be a bit haphazard when I started with KKPro. I can see how to search for and delete duplicate source entries, but in certain cases I would like to find and review those person/family records where a particular source is referred to. Is it possible to use the Query function to flag up those records?

Regards: Roger Donne

Nick Hunter
Posts: 669
Joined: Sun Dec 18, 2005 9:36 am
Location: SpanSoft, Scotland
Contact:

Post by Nick Hunter » Mon Apr 16, 2007 9:09 pm

Yes. Using SQL is very good for this kind of thing.

The following SQL query will give you a list of all the source references, sorted by the document code. Just copy and paste this into the SQL query box and click "Apply".

SELECT S.RecordType, S.RecordCode, S.FieldName, D.Code, D.Title
FROM Sources S, Documents D
WHERE S.Document = D.Code
ORDER BY D.Code


The RecordType, RecordCode and FieldName columns in the result tell you which person/family and which of their fields the source applies to. The Code and Title columns refer to the Document.

This type of SQL query is called a "join" because it joins the results from several tables together, in this case the "Sources" table and the "Documents" table. The "Document" field in the Sources table is a pointer into the Documents table so by using "WHERE S.Document = D.Code" the query displays the correct document title for the source in question.

To make things simpler the table names have been abbreviated to "S" and "D" by using "FROM Sources S, Documents D". This means that you can refer to the fields in the rest of the query by using S or D; eg. "S.Document" means the Document field in the Sources table.

donne
Posts: 80
Joined: Wed Dec 28, 2005 12:46 pm
Location: UK
Contact:

Post by donne » Tue Apr 17, 2007 8:38 pm

Thanks, Nick, that worked really neatly. I hadn't realised how useful the Query tool can be. Obviously I need to read up on SQL to get the best out of it.

Regards: Roger Donne

Locked