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
Working with Sources
Moderator: Nick Hunter
-
- Posts: 669
- Joined: Sun Dec 18, 2005 9:36 am
- Location: SpanSoft, Scotland
- Contact:
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.
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.