convert daily form activity report to SQL