Changes between Version 11 and Version 12 of OnyxDatabaseReporting


Ignore:
Timestamp:
02/13/13 11:39:01 (12 years ago)
Author:
Nick Holden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OnyxDatabaseReporting

    v11 v12  
    201201ORDER BY start_date
    202202;
     203
     204# To find duplicates enrollment_id entries:
     205
     206mysql -h briccsdb -u auditor -pg3s4t6 briccs -e "SELECT * FROM participant ptone WHERE EXISTS (SELECT 1 FROM participant pttwo WHERE pttwo.enrollment_id = ptone.enrollment_id LIMIT 1, 1 );"
     207
     208
     209# So to exclude duplicates and NULL BPt numbers:
     210
     211mysql -h briccsdb -u auditor -pg3s4t6 briccs -e "SELECT * FROM participant ptone WHERE NOT EXISTS (SELECT 1 FROM participant pttwo WHERE pttwo.enrollment_id = ptone.enrollment_id LIMIT 1, 1 ) AND barcode is not null order by enrollment_id;"
     212
     213# To exclude duplicates, nulls and cancelled interviews and list barcodes (BPt numbers) and enrollment dates:
     214
     215mysql -h briccsdb -u auditor -pg3s4t6 briccs -e "SELECT barcode, start_date, status
     216FROM participant ptone, interview WHERE NOT EXISTS (SELECT 1 FROM participant pttwo WHERE pttwo.enrollment_id = ptone.enrollment_id LIMIT 1, 1 ) AND barcode is not null AND status <> 'CANCELLED'
     217AND ptone.id = interview.participant_id order by start_date;" > briccs_enrollment_to_date.txt
     218
     219# To get a count of the above:
     220
     221mysql -h briccsdb -u auditor -pg3s4t6 briccs -e "SELECT count(*)
     222FROM participant ptone, interview WHERE NOT EXISTS (SELECT 1 FROM participant pttwo WHERE pttwo.enrollment_id = ptone.enrollment_id LIMIT 1, 1 ) AND barcode is not null AND status <> 'CANCELLED'
     223AND ptone.id = interview.participant_id order by start_date;"
     224
     225