Click here to Skip to main content
15,904,652 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Server Search Critiera.................... Pin
Isaac Gordon18-Jun-09 20:05
Isaac Gordon18-Jun-09 20:05 
GeneralRe: SQL Server Search Critiera.................... Pin
Ashfield18-Jun-09 21:22
Ashfield18-Jun-09 21:22 
GeneralRe: SQL Server Search Critiera.................... Pin
Isaac Gordon19-Jun-09 0:06
Isaac Gordon19-Jun-09 0:06 
GeneralRe: SQL Server Search Critiera.................... Pin
Ashfield19-Jun-09 5:14
Ashfield19-Jun-09 5:14 
GeneralRe: SQL Server Search Critiera.................... Pin
Isaac Gordon19-Jun-09 21:16
Isaac Gordon19-Jun-09 21:16 
GeneralRe: SQL Server Search Critiera.................... Pin
Ashfield20-Jun-09 6:22
Ashfield20-Jun-09 6:22 
GeneralRe: SQL Server Search Critiera.................... Pin
Niladri_Biswas25-Jun-09 16:38
Niladri_Biswas25-Jun-09 16:38 
QuestionHow to get only one record ... Pin
Kyudos18-Jun-09 18:44
Kyudos18-Jun-09 18:44 
I'm a bit of an SQL novice, so I have a feeling this is easy, but I can't figure it out and I'm Googled out trying to find the answer.

I have a query:

SELECT CONTACT.FIRSTNAME, CONTACT.LASTNAME, CONTACT.COMPANYNAME, CONTACT.USER2, EMAIL.ADDRESS
FROM dbo.CONTACT CONTACT, dbo.EMAIL EMAIL
WHERE CONTACT.CONTACTID = EMAIL.CONTACTID
ORDER BY CONTACT.LASTNAME DESC


That's fine, but contacts may have more than one email. So I might get, the following records as a result:

Ann Onymous	Initech	v7.35	ann.onymous@initech.com
Ann Onymous	Initech	v7.35	a.onymous@initech.com
Ann Onymous	Initech	v7.35	onymousa@initech.com


If I use Count(EMAIL.ADDRESS) I'd get 3 for Ann.

So how do I tell SQL to just get me the first email record and not the other two? e.g.

Ann Onymous	Initech	v7.35	ann.onymous@initech.com


I'm pretty sure its simple...but..so am I! Big Grin | :-D
AnswerRe: How to get only one record ... Pin
_Damian S_18-Jun-09 19:16
professional_Damian S_18-Jun-09 19:16 
GeneralRe: How to get only one record ... Pin
Niladri_Biswas19-Jun-09 3:44
Niladri_Biswas19-Jun-09 3:44 
GeneralRe: How to get only one record ... Pin
Kyudos21-Jun-09 11:08
Kyudos21-Jun-09 11:08 
AnswerRe: How to get only one record ... Pin
Niladri_Biswas19-Jun-09 3:54
Niladri_Biswas19-Jun-09 3:54 
GeneralRe: How to get only one record ... Pin
Kyudos21-Jun-09 11:12
Kyudos21-Jun-09 11:12 
GeneralRe: How to get only one record ... Pin
Eddy Vluggen21-Jun-09 13:04
professionalEddy Vluggen21-Jun-09 13:04 
GeneralRe: How to get only one record ... Pin
Kyudos22-Jun-09 11:08
Kyudos22-Jun-09 11:08 
QuestionMySQL+PHP - Problem with Query not showing all results Pin
47_MasoN_4718-Jun-09 11:32
professional47_MasoN_4718-Jun-09 11:32 
AnswerRe: MySQL+PHP - Problem with Query not showing all results Pin
smcnulty200019-Jun-09 0:37
smcnulty200019-Jun-09 0:37 
GeneralRe: MySQL+PHP - Problem with Query not showing all results Pin
47_MasoN_4719-Jun-09 4:25
professional47_MasoN_4719-Jun-09 4:25 
QuestionWhat I'm I missing? Pin
DJ Matthews18-Jun-09 4:07
DJ Matthews18-Jun-09 4:07 
AnswerRe: What I'm I missing? Pin
David Mujica18-Jun-09 4:38
David Mujica18-Jun-09 4:38 
GeneralRe: What I'm I missing? Pin
DJ Matthews18-Jun-09 4:48
DJ Matthews18-Jun-09 4:48 
AnswerRe: What I'm I missing? Pin
Luc Pattyn18-Jun-09 4:50
sitebuilderLuc Pattyn18-Jun-09 4:50 
GeneralRe: What I'm I missing? Pin
DJ Matthews18-Jun-09 4:53
DJ Matthews18-Jun-09 4:53 
GeneralRe: What I'm I missing? Pin
Luc Pattyn18-Jun-09 5:04
sitebuilderLuc Pattyn18-Jun-09 5:04 
Questionsql server 2008 to 2000 Pin
Ebube18-Jun-09 2:38
Ebube18-Jun-09 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.