If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Identify duplicate zip code + 4 digits zip

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-23-03, 12:30
K. Lo K. Lo is offline
Registered User
 
Join Date: Sep 2003
Location: baltimore, MD
Posts: 2
Identify duplicate zip code + 4 digits zip

Hi, all
If I have two columns, zip_cd and zip_4_cd, and I want to check for any records with identical zip_cd and zip_4_cd, how would I do that? I've tried different ways but I still can't figure it out...
Some attempts:

SELECT sum(COUNT(DISTINCT ZIP_CD))
FROM table name
group by zip_4_CD

select count(zip_4_cd))
from table_name
where zip_cd=
(select min(zip_cd)
from table_name
group by zip_cd)
Reply With Quote
  #2 (permalink)  
Old 09-23-03, 15:23
Ida Hoe Ida Hoe is offline
Registered User
 
Join Date: Aug 2003
Location: West
Posts: 98
Re: Identify duplicate zip code + 4 digits zip

SELECT
COUNT(ZIP_CD + ZIP_4_CD) AS Expr1,
ZIP_CD + ZIP_4_CD AS Expr2
FROM table name
GROUP BY ZIP_CD + ZIP_4_CD



Quote:
Originally posted by K. Lo
Hi, all
If I have two columns, zip_cd and zip_4_cd, and I want to check for any records with identical zip_cd and zip_4_cd, how would I do that? I've tried different ways but I still can't figure it out...
Some attempts:

SELECT sum(COUNT(DISTINCT ZIP_CD))
FROM table name
group by zip_4_CD

select count(zip_4_cd))
from table_name
where zip_cd=
(select min(zip_cd)
from table_name
group by zip_cd)
Reply With Quote
  #3 (permalink)  
Old 09-23-03, 15:34
K. Lo K. Lo is offline
Registered User
 
Join Date: Sep 2003
Location: baltimore, MD
Posts: 2
Cool thanks for the help

but zip_cd and zip_4_cd are two different columns.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On