Jump to content
TNG Community
JPT

Report: Sources by Reference Count

Recommended Posts

JPT

This report shows the sources and how often they are referenced to.

select x.gedcom,
	x.sourceid as id,
	quantity,
	concat ('<a href="showsource.php?sourceID=',x.sourceid, '&tree=', x.gedcom, '">',shorttitle, '</a>') as source,
	title
from (
	SELECT s.gedcom,s.sourceID, COUNT(*) AS quantity
	FROM tng_sources AS s 
	LEFT JOIN tng_citations AS c ON s.sourceID=c.sourceID and s.gedcom=c.gedcom
	GROUP BY s.gedcom,s.sourceID 
) as x
join tng_sources as t on x.gedcom=t.gedcom and x.sourceid = t.sourceid 
order by gedcom, quantity desc;

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×