Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to exclude data from query

Status
Not open for further replies.

tobermory20

Programmer
Dec 7, 2007
20
US
Hello,

I have a statement simular to this:
Code:
SELECT     userid, last_name, first_name
FROM       organizationalPerson
WHERE     (full_name LIKE '% txtLastName %')
ORDER BY last_name, first_name

My results are vary in feedback depending on the variable txtLastName. Here is my issue, I get multiple ID's back and one person could have 5 entries. All I want to return is something like A1000 and not A1000S. How can I accomplish this goal?

Regards,
~ T
 
Found what I was looking for the answer should be:
Code:
SELECT [COLOR=red]DISTINCT SUBSTRING(userid, 1, 5)[/color], last_name, first_name 
FROM  organizationalPerson
WHERE     (full_name LIKE '% texLastName %')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top