|
Home > Archive > MS SQL Server MSEQ > October 2006 > parameter query
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Brian L 2006-10-26, 12:15 am |
| I have a table of doctors, each doctor is assigned a unique identifier, but
may have mulitple offices in diff cities with differnent id numbers. When
writing my paramter query to build a list of doctos, I am seeing duplicates.
query looks like this:
select rtrim(LastName) +', ' +Rtrim(Firstname) +MidleInitial As DocName
FROM doctors
ORDER by DocName
When I used to use Access, I could set the parameter to Like @Param & "*"
and it would only show one name.
What am I missing here?
| |
| Arnie Rowland 2006-10-26, 12:15 am |
| I'm not sure what is happening and what you desire.
If I understand this correctly, you want a list of Doctors, without duplicates -even from different offices. If so, then this approach may work for you.
SELECT DISTINCT
DocName = rtrim( LastName ) + ', ' + rtrim( Firstname ) + ' ' + MidleInitial
FROM Doctors
ORDER by DocName
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the top yourself.
- H. Norman Schwarzkopf
"Brian L" <BrianL@discussions.microsoft.com> wrote in message news:65064E66-9BC8-4BAD-8779- E9C956ACDB60@microso
ft.com...
>I have a table of doctors, each doctor is assigned a unique identifier, but
> may have mulitple offices in diff cities with differnent id numbers. When
> writing my paramter query to build a list of doctos, I am seeing duplicates.
> query looks like this:
>
> select rtrim(LastName) +', ' +Rtrim(Firstname) +MidleInitial As DocName
> FROM doctors
> ORDER by DocName
>
> When I used to use Access, I could set the parameter to Like @Param & "*"
> and it would only show one name.
>
> What am I missing here?
|
|
|
|
|