MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 14th, 2004, 05:09 AM
dast's Avatar
dast dast is offline
web muppet
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: blackpool, uk
Posts: 47 dast User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 19 m 29 sec
Reputation Power: 5
Wink stopping duplicates

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."

Reply With Quote
  #2  
Old April 14th, 2004, 06:46 AM
Mandrill Mandrill is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 97 Mandrill User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 sec
Reputation Power: 5
Send a message via ICQ to Mandrill Send a message via MSN to Mandrill
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

Reply With Quote
  #3  
Old April 14th, 2004, 08:18 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 25th Plane (17000 - 17499 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,344 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 5 Days 8 h 26 m 34 sec
Reputation Power: 891
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 what you're asking is "can i suppress the 12?" the answer is yes, just don't include that column in the SELECT list

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
__________________
r937.com | rudy.ca

Reply With Quote
  #4  
Old April 14th, 2004, 10:24 AM
dast's Avatar
dast dast is offline
web muppet
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: blackpool, uk
Posts: 47 dast User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 19 m 29 sec
Reputation Power: 5
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)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > stopping duplicates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway