Forum

Please or Register to create posts and topics.

Question re getting from citation to event or fact in #RM8

PreviousPage 2 of 2

No.  I also don't understand how the Citationlinktable relates to the EventTable.  If I could figure that out it would make things easier.

We have the database diagram, but a lot of that is still not clear.

See @patjones post Understanding the RootsMagic 8 database - Ownership. Under the column "Can own citation" you will see what OwnerType(s) can 'own' a citation. In the OwnerType column, scan down to Event and beside it the OwnerType value = 2. Therefore, a record in the CitationLinkTable with OwnerType=2 means that the OwnerID=EventTable.EventID. To retrieve information from the EventTable for a given CitationLink:

SELECT * FROM CitationLinkTable AS CL, EventTable AS E
WHERE CL.OwnerType=2
AND CL.OwnerID=E.EventID ;

or, using JOIN,

SELECT * FROM CitationLinkTable AS CL
JOIN EventTable AS E
ON CL.OwnerID=E.EventID
WHERE CL.OwnerType=2;

Those are equivalent queries, giving exactly the same results, but the second has me puzzled because it ends with a SQLite Error 1, a generic error telling me nothing.

If you use LEFT JOIN, then any CitationLinkTable records of OwnerType=2 that have no corresponding EventTable record will also be listed. Those would be broken links

As written, both result sets are in order of LinkID. You could change the order with the addition of an ORDER BY E.EventID clause to put all the citation links for a give event together. If you DB Browser lets you sort by column, that's the same thing.

Ali Christie-Upton has reacted to this post.
Ali Christie-Upton
PreviousPage 2 of 2