Need Help to make a query

Discussion in 'C#' started by keyem, Mar 8, 2010.

  1. #1
    I need a multiple query method.

    Now let me tell you about my project

    I have 5 tables
    1. Table Allergy_test_names

    fields
    test_id test_name

    2 Table Allergy_test_results

    fields
    id test_id patient_id result

    3. Table Diagonostic_names

    fields
    diagonostic_id diagonostic_name

    4. Table Diagonostic_result

    fields
    id diagonostic_id diagonostic_test_result patient_id

    5. Table Patients

    fields
    patient_id name surname


    I need to make a query which is below

    Assume that we have 5 patients

    Allergy Results
    2 of them have olive allergy,mite allergy
    1 of them has dog allergy
    2 of them have mite allergy,cat allergy

    diagonostic Results
    2 of them have high blood pressure and urticaria
    2 of them have urticaria
    1 of them has asthma

    A query sample

    How many patients who have both cat allergy and dog allergy and at the same time have asthma? Its answer is zero

    Another one
    How many patients who have asthma and at the same time have mite allergy? One patient... if the patient who is asthma has mite allergy otherwise the answer is zero.

    Now I have 2 multiple comboboxes

    Allergy Tests Diagonostics
    Test 1 Dia 1
    Test 2 Dia 2
    Test 3 Dia 3
    . .
    . .
    . .

    How can i make such this queries.

    I tried to use split function but i faced out of range error
     
    keyem, Mar 8, 2010 IP