Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    15

    Unanswered: using SUM function to display multiple results

    select sum(leave)
    from database
    where emp_name like 'john%'
    or emp_name like 'wayne%'
    and job = 'clerk';

    The results will display the sum of john's and wayne's total medical leave together. What i want is to display the total of John's medical leave and the total of Wayne's medical leave separately. How to i go about doing that? I'm using MS Access to query.

    Many thanks to those that are willing to help me out here.

    mal10

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Exclamation

    Try this:

    select emp_name, sum(leave)
    from database
    where emp_name like 'john%'
    or emp_name like 'wayne%'
    and job = 'clerk'
    group by emp_name;

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •