Query not returning distinct value
-
Hi, I am firing a query as "select distinct(trim(opp_name)) from tblOpps" but this query returns ============ Renewal Services Renewal New I want Renewal to appear only once not twice Thnaks, Mini
-
Hi, I am firing a query as "select distinct(trim(opp_name)) from tblOpps" but this query returns ============ Renewal Services Renewal New I want Renewal to appear only once not twice Thnaks, Mini
-
i agree with ritu4321. but if you intend to remove trailing or preceding space, you can use
rtrim
orltrim
. But please note thatltrim
andrtrim
does not remove extra spaces within the string, only those at the beginning (forltrim
) and those at the end (forrtrim
). Hope this helps.Remember, your work is not yours alone. Somewhere, there are some codes written by others amongst us that depends on your work. By failing to see that you are part of their ecosystem, you are bound to break their code.
-
Hi, I am firing a query as "select distinct(trim(opp_name)) from tblOpps" but this query returns ============ Renewal Services Renewal New I want Renewal to appear only once not twice Thnaks, Mini
DISTINCT
should be used as aSELECT
operator, not as a function. I also do not know where you get thetrim()
function from.SELECT DISTINCT LTRIM(RTRIM(opp_name)) FROM tblOpps
-
DISTINCT
should be used as aSELECT
operator, not as a function. I also do not know where you get thetrim()
function from.SELECT DISTINCT LTRIM(RTRIM(opp_name)) FROM tblOpps
if you get stuck try and use the len (length function) sometimes using or importing unicode string (nvarchar etc) can cause issues.
SELECT DISTINCT LTRIM(RTRIM(opp_name)), len(opp_name), len(LTRIM(RTRIM(opp_name))) FROM tblOpps
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture) http://www.frankkerrigan.com/[^]