iglpdc
12/10/2015 - 6:55 PM

Get the list of active PET projects from the acct database as a CSV file

Get the list of active PET projects from the acct database as a CSV file

#!/bin/bash
# Get the list of active PET projects from the acct database as a CSV file
#
# Returns all projects currently active in any of the three PET bays: bay6, bay7, or mPET.
#
# Usage: bash get_active_pet_projects.sh outfile.csv
#
mysql -u petdb -h mysql -p << END | sed 's/\t/,/g' > $1
select distinct P.CODE,U.FULLNAME,P.NAME,CONCAT('"', P.GRANTNUM, '"'),P.SRAC_IRB
from acct.PROJECTS P
left join acct.PROJ_F_PRIV PFP on PFP.PID = P.PID
left join acct.USERS U on U.UID = P.PI
where PFP.FID in (39,32,33) and P.ACTIVE = 'Y';
END