Ed
asked on
SQL Distinct Question
I have a query that returns distinct depending on EmployerID as below.
I want to ignore the .1 in my distinct statement, how do I do that?
Eg
When I do this
I will get the below results.
BUT
I would only want 1 row returned.
How do I get the distinct statement to ignore the .1
EMPLOYER ID
0974-0001-103849
0974-0001-103849.1
I want to ignore the .1 in my distinct statement, how do I do that?
Eg
When I do this
SELECT distinct EMPLOYERID,
I will get the below results.
BUT
I would only want 1 row returned.
How do I get the distinct statement to ignore the .1
EMPLOYER ID
0974-0001-103849
0974-0001-103849.1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If position of ".1" is fixed in the employee id that it will occur only at the end for id.
You can write query like
Hope it will help.
You can write query like
;WITH Cte_EmpId
As
(
SELECT distinct EMPLOYERID
)
SELECT * FROM Cte_EmpId
WHERE RIGHT(EMPLOYERID,2) <>'.1'
Hope it will help.
ASKER