Query Library

Casey Trauer submitted this query on: August 21, 2009 4:46pm EDT
TITLE Find the most recent document for fixture key and league
SPORTS ALL SPORTS
QUERY SELECT d.*
FROM documents d
JOIN document_fixtures df ON d.document_fixture_id = df.id
JOIN affiliations_documents ad ON d.id = ad.document_id
JOIN affiliations a ON a.id = ad.affiliation_id
JOIN publishers pub ON pub.id = d.publisher_id

WHERE 
pub.publisher_key = 'sportsnetwork.com'
AND a.affiliation_type = 'league'
AND a.affiliation_key = 'l.mlb.com'
AND df.fixture_key = 'weather'

ORDER BY d.date_time DESC
LIMIT 0,1;
DESCRIPTION This returns info on the latest document for a given fixture key and league. Use it to find the last-update time for example.
DBs TESTED MySQL
ADDITIONAL NOTES
Your log.directory config setting does not point to a writable directory.