-- Example SQL Query for Parsing Which QSOs Are Worth for Upload to LoTW SELECT round((julianday(qso.t_until) - julianday(qso.t_from))*24*60, 1) AS 'Minutes', qso.t_from AS 'When', qso.t_until AS 'Until', qth.call_sign AS 'Station', qso.freq AS 'MHz', qso.how AS 'Mode' FROM qso, qth WHERE qso.net IS NULL AND qso.qth_sent_id IN (SELECT qth_sent_id FROM my_callsigns WHERE flag = 1) AND t_from > "YYYY" -- See note below AND t_until <= "UUUU" -- See note below AND qso.qth_rcvd_id = qth.rowid AND ( ( -- If QSO with Domestic station one half my average. qth.country IN ("United States", "Canada") AND Minutes >= XXX -- See note below ) OR ( -- If QSO with DX station one quarter my average. qth.country NOT IN ("United States", "Canada") AND Minutes >= ZZZ -- See note below ) OR ( -- If have ever received a card from that op. 1 <= ( SELECT count(rowid) FROM qso WHERE qso.qth_rcvd_id = qth.rowid AND qso.qsl_rcvd > 0 ) ) OR ( -- If have ever enjoyed a rag chew with that op. qso.qth_rcvd_id IN ( SELECT qth_rcvd_id FROM qso WHERE WWW <= round((julianday(t_until) - julianday(t_from))*24*60, 1) ) ) OR ( -- If a op was QRP with poor signal strength both ways qso.pwr_rcvd <= 10 AND qso.rst_sent NOT IN ('579', '589', '599') AND qso.rst_rcvd NOT IN ('579', '589', '599') AND Minutes >= 3 ) ) ORDER BY qso.t_from DESC; -- Note: YYYY, UUUU, XXX, and YYY are flags replaced by Perl at query time.