Confirm

Need Zero Counting/Adding in SQL Results

  • 1.  Need Zero Counting/Adding in SQL Results

    Posted 16 days ago
    Hi All

    Anyone know where i put a JOIN in the SQL below so that it counts and adds Zeros to the results?  Been struggling for a couple of hours now so any help is appreciated as my SQL knowledge needs improving.

    Regards Martin.

    SELECT
    cust_type_code,
    service_code,
    subject_code,
    subject_name,
    Total_Enquiries

    FROM
    (SELECT
    enquiry_customer.cust_type_code,
    central_enquiry.service_code,
    enquiry_subject.subject_code,
    enquiry_subject.subject_name,
    COUNT( enquiry_subject.subject_code) Total_Enquiries

    FROM
    central_enquiry,
    enquiry_cust_link,
    enquiry_customer,
    enquiry_subject

    WHERE
    cust_type_code ='CONT' AND
    central_enquiry.enquiry_time >= '01-AUG-2019' AND
    enquiry_customer.customer_number = enquiry_cust_link.customer_number AND
    enquiry_subject.service_code = central_enquiry.service_code AND
    enquiry_subject.subject_code = central_enquiry.subject_code AND
    central_enquiry.enquiry_number = enquiry_cust_link.enquiry_number

    Group By
    enquiry_customer.cust_type_code,
    central_enquiry.service_code,
    enquiry_subject.subject_code,
    enquiry_subject.subject_name)

    ------------------------------
    Martin Langler
    EAST RIDING OF YORKSHIRE COUNCIL
    BEVERLEY
    ------------------------------