|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
I have got the statment below but it pulls out duplicates, because maybe more than one call has been made, anyone know how i can stop this?
SELECT dbo.tblContactLog.CallBackEmployee_id, dbo.tblLeads.surname FROM dbo.tblLeads INNER JOIN dbo.tblContactLog ON dbo.tblLeads.lead_id = dbo.tblContactLog.lead_id WHERE (dbo.tblContactLog.CallBackEmployee_id = 12)
__________________
"When I read about the evils of drinking, I gave up reading."
|
|
#2
|
|||
|
|||
|
Hi Dast
The query is returning exactly what you are asking for. To narrow it down you will have to look at your table stucture. I assume the call will have some other relevance like a time stamp or a subject or even better an unique id. Cheers Darrell |
|
#3
|
||||
|
||||
|
what you have there does indeed look like a one-to-many relationship
Code:
id surname 12 smith 12 jones 12 mccoy 12 brown if you're asking is "can i make it look like this? --" Code:
id surname 12 smith jones mccoy brown the answer is "not very easily and not very efficiently" this is best done in your scripting language |
|
#4
|
||||
|
||||
|
I kinda solved the problem by doing this..
SELECT COUNT(DISTINCT tblLeads.surname) AS NumberOfCallbacks FROM tblLeads INNER JOIN tblContactLog ON tblLeads.lead_id = tblContactLog.lead_id WHERE (tblContactLog.CallBackEmployee_id = 12) |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > stopping duplicates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|