September 29, 2002 at 6:57 pm
Hello,
I have a T-SQL query that returns a couple of columns of data. It looks like the following...
Call_Id Caller_Name
32543 Tom
32456 Jerry
23523 Tom
23452 Simon
32451 Lee
23522 Lee
The code is the following...
select dbo.unz_calls.call_id, dbo.unz_calls.caller_name
from dbo.unz_calls
where dbo.unz_calls.caller_name not in
(select [name] from dbo.survey_blacklist)
and dbo.unz_calls.call_status = 'Closed' and
((dbo.unz_calls.customer_name = 'UNISYS NEW ZEALAND LTD') or
(dbo.unz_calls.customer_name = 'ACC' and dbo.unz_calls.call_via = 'SERVICE DESK' ) or
(dbo.unz_calls.customer_name = 'PLACEMAKERS') or
(dbo.unz_calls.customer_name = 'LAND TRANSPORT SAFETY AUTHORITY' and dbo.unz_calls.call_type <> 'VIRUS') or
(dbo.unz_calls.customer_name = 'INLAND REVENUE')) and
dbo.unz_calls.caller_name not in
(select dbo.customer_survey_main.caller_name from dbo.customer_survey_main
where dbo.customer_survey_main.import_date > dateadd(day, -30, getdate()) and
dbo.customer_survey_main.q1 is not null) and
dbo.unz_calls.create_date > dateadd(day,-7,getdate())
What I would like is to only get one record per caller. My query returns two records for Tom and another two for Lee. I only want it to return one for each caller. I've tried using the distinct key word but the call_id is going to be different in all cases. I'm stuck, any assistance would be much appreciated.
Cheers,
Chris Rutherford
September 29, 2002 at 8:31 pm
Hello,
Well I do this a lot but soon after I posted the above request for assistance I figured out the issue. Thanks anyhow.
Cheers,
Chris Rutherford
October 2, 2002 at 7:55 am
I have a similar problem. What was your solution? Any help would be appriciated.
From listening comes wisdom^M^M^M+++AT0
From listening comes wisdom^M^M^M+++AT0
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply