Author |
Topic |
nrusa
Starting Member
4 Posts |
Posted - 2008-02-15 : 20:48:56
|
HI,I have "Customer" table in that table couple of customers are in same Address. I need to find out them. But, while seeing the data, I understand that user entered data in different format, But the address is same.Ex: 1) 2632 LUCY GARRETT RD2) 2632, LUCY GARRETT RDAbove 2 street names are same, But my SQL written 2 rows. Is there any why to skip "," and " " ( Space ) .1) There are 2 spaces between "LUCY" and "GARRETT" but in 2) One space in between "LUCY" and "GARRETT". I am looking for the comparison like if characters and numbers are same then the street name is same. Pls help me to fix the issue or Pls guide me how to handle this.Thanks in advanceNR |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-16 : 01:37:08
|
use like this for comparisonLTRIM(RTRIM(REPLACE(REPLACE(Address1,',',''),' ','')))=LTRIM(RTRIM(REPLACE(REPLACE(Address2,',',''),' ',''))) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-18 : 03:33:11
|
quote: Originally posted by visakh16 use like this for comparisonLTRIM(RTRIM(REPLACE(REPLACE(Address1,',',''),' ','')))=LTRIM(RTRIM(REPLACE(REPLACE(Address2,',',''),' ','')))
You dont need TRIMs as you replace space with empty string MadhivananFailing to plan is Planning to fail |
 |
|
nrusa
Starting Member
4 Posts |
Posted - 2008-02-19 : 21:59:23
|
I appreciate your help Visakh. It works fine.. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-20 : 00:25:43
|
quote: Originally posted by madhivanan
quote: Originally posted by visakh16 use like this for comparisonLTRIM(RTRIM(REPLACE(REPLACE(Address1,',',''),' ','')))=LTRIM(RTRIM(REPLACE(REPLACE(Address2,',',''),' ','')))
You dont need TRIMs as you replace space with empty string MadhivananFailing to plan is Planning to fail
yup. thats true madhi . Nice spot |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-20 : 01:05:12
|
quote: Originally posted by visakh16
quote: Originally posted by madhivanan
quote: Originally posted by visakh16 use like this for comparisonLTRIM(RTRIM(REPLACE(REPLACE(Address1,',',''),' ','')))=LTRIM(RTRIM(REPLACE(REPLACE(Address2,',',''),' ','')))
You dont need TRIMs as you replace space with empty string MadhivananFailing to plan is Planning to fail
yup. thats true madhi . Nice spot 
No Problem. This happens to all MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|