Changes between Version 4 and Version 5 of OnyxDatabaseReporting


Ignore:
Timestamp:
01/16/12 15:10:40 (13 years ago)
Author:
Nick Holden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OnyxDatabaseReporting

    v4 v5  
    8989;
    9090" > mysql-output.txt
     91
     92
     93Single diagnosis, count:
     94
     95SELECT count(participant.id) as 'Number of Participants'
     96FROM participant, questionnaire_participant, question_answer, category_answer 
     97WHERE participant.id = questionnaire_participant.participant_id 
     98AND question_answer.questionnaire_participant_id = questionnaire_participant.id 
     99AND ( question_answer.question_name = 'epi_pridiag' OR question_answer.question_name = 'epi_secdiag' )
     100AND category_answer.question_answer_id = question_answer.id 
     101AND category_answer.category_name = 'Aortic_Stenosis';
     102
     103
     104Complex query, using two references to the same tables, to derive those of a certain diagnosis (primary or secondary) where the recruitment context is not 'Study specific':
     105
     106SELECT count(participant.id) as 'AS not study recruited'
     107FROM participant, questionnaire_participant as diag_questionnaire, questionnaire_participant as context_questionnaire, question_answer as diag_question, category_answer as diag_answer, question_answer as context_question, category_answer as context_answer
     108WHERE participant.id = diag_questionnaire.participant_id 
     109AND participant.id = context_questionnaire.participant_id 
     110AND diag_questionnaire.id = diag_question.questionnaire_participant_id
     111AND ( diag_question.question_name = 'epi_pridiag' OR diag_question.question_name = 'epi_secdiag' )
     112AND diag_answer.question_answer_id = diag_question.id
     113AND diag_answer.category_name = 'Aortic_Stenosis'
     114AND context_questionnaire.id = context_question.questionnaire_participant_id
     115AND context_question.question_name = 'epi_type'
     116AND context_answer.question_answer_id = context_question.id
     117AND context_answer.category_name <> 'Study_specific'
     118;
     119