I'm hoping I can get this query to group my totals correctly.
- All of the data I need to search for lives in one table -
select max(study_custom1) as 'Outside Institution', COUNT(study_custom1) as 'Number of Studies'
where accession_no like '%OUT%'
and study_custom1 is not null
and created_time >= DATE_FORMAT( CURRENT_DATE - INTERVAL 1 MONTH, '%Y/%m/01' )
AND created_time < DATE_FORMAT( CURRENT_DATE, '%Y/%m/01' )
group by study_custom1
order by 'Number of Studies' DESC
this result comes back with:
I would like for the results to show the site with the most 'counts' to be at the top of the list.