A sample image of this SQL report run in the Database Viewer is shown below:
This sql takes a while to run the report. Do not run for periods exceeding one or two months. For an extensivedate range "Not Responding" may appear in the window while the data is gathered.
To highlight and copy the code below to your clipboard, simply click the Copy button.
select at1.patno, at1.invoiceno,staffname, at2.cptcode as sick, at3.cptcode as well from (select distinct patno, invoiceno, rend_addr_id from archive_transactions where date1 between :start_date and :end_Date) at1 inner join (select patno, invoiceno, date1, cptcode from archive_transactions where cptcode between '99201' and '99215' and cptcode <> '99211' and date1 between :start_date and :end_date) at2 on at2.invoiceno = at1.invoiceno inner join (select patno, invoiceno, date1, cptcode from archive_transactions where cptcode between '99381' and '99395' and date1 between :start_date and :end_date) at3 on at3.invoiceno = at1.invoiceno inner join staff1 on staff1.staffid = at1.rend_addr_id