Hey guys,
I am trying to write a query that will search for employees receiving payment from two agencies.
First, consider my table HISTORY:
Name AGENCY AMOUNT
_____ _______ _______
Harry Smith ATTS 12,000.03
Reed Jones RTSE 13,000.04
Harry Smith ASSP 5,000.23
With this data set, I want the record to only return the name Harry Smith since he has service in two different agencies.
I tried using count(*) > 1 on the Name field which did seem to work except for one problem. Some names have more than one record in the table for the same agency name. Such as:
Name AGENCY AMOUNT
_____ _______ _______
Jerry Smith ATTS 12,000.03
Reed Jones RTSE 13,000.04
Jerry Smith ATTS 5,000.23
How can I write a query to weed out these returns?
I am trying to write a query that will search for employees receiving payment from two agencies.
First, consider my table HISTORY:
Name AGENCY AMOUNT
_____ _______ _______
Harry Smith ATTS 12,000.03
Reed Jones RTSE 13,000.04
Harry Smith ASSP 5,000.23
With this data set, I want the record to only return the name Harry Smith since he has service in two different agencies.
I tried using count(*) > 1 on the Name field which did seem to work except for one problem. Some names have more than one record in the table for the same agency name. Such as:
Name AGENCY AMOUNT
_____ _______ _______
Jerry Smith ATTS 12,000.03
Reed Jones RTSE 13,000.04
Jerry Smith ATTS 5,000.23
How can I write a query to weed out these returns?