Can we de-dupe on the Name, first line of address and postcode in SQL SERVER !!

Hi Friends I have 7K records in my Table. the Columns are ID, Name, Address 1 , Address 2, Address 3, postcode. 
how can we de-dupe on the name , Address 1 and postcode Can you please advise me  How can we write SQ query for this requirement I will grateful to you. 
I Need to delete Same name and same postcode rerecordss!!!

Cherukuri,
check this:
create table #temp
id int,
name varchar(100),
address1 varchar(100),
address2 varchar(100),
postcode varchar(100)
insert #temp select 1,'jay','Johns street',NULL,'34535'
insert #temp select 2,'jk','Smiths street',NULL,'34512'
insert #temp select 1,'jay','Johns street',NULL,'34535'
insert #temp select 3,'kumaur','Marks street',NULL,'123456'
select * from #temp
;with cte
as
select *,row_number() over(partition by name,address1,postcode order by name,address1,postcode) as rnum
from #temp
delete From cte
where rnum<>1
select * from #temp
drop table #temp
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Similar Messages

  • How to get a list of values used in the WHERE filter of stored procedures and functions in SQL Server

    How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
    How can get a list of values as shown (highlighted) in the sample stored procedure below?
    ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
    SELECT   [LOAN_ACCT].PROD_DT,
                  [LOAN_ACCT].ACCT_NBR, 
                  [LOAN_NOTE2].OFCR_CD, 
                  [LOAN_NOTE1].CURR_PRIN_BAL_AMT, 
                  [LOAN_NOTE2].BR_NBR,
    INTO #Table1
    FROM
                    dbo.[LOAN_NOTE1],
                    dbo.[LOAN_NOTE2],
                    dbo.[LOAN_ACCT]
    WHERE
                    [LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
                    and
                    [LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
                    and
                    [LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
                    and
                    [LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
                    and
                    [LOAN_ACCT].PROD_DT = '2015-03-10'
                    and
                    [LOAN_ACCT].ACCT_STAT_CD IN
    ('A','D')
                    and
                    [LOAN_NOTE2].LOAN_STAT_CD IN
    ('J','Z')
    Lenfinkel

    Hi LenFinkel,
    May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
    I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
    For multiple values paramter you can use a
    table-valued parameter. Then there's no problem getting the values.
    If you could elaborate your purpose, we may help to find better workaround.
    Eric Zhang
    TechNet Community Support

  • I changed the name of my apple id and now I can't use the app store on my phone correctly because it's using my apple id's old name. I signed out and in on itunes and synced my iphone. Still doesn't work. Help please?

    I changed the name of my apple id and now I can't use the app store on my phone correctly because it's using my apple id's old name. I signed out and in on itunes and synced my iphone. Still doesn't work. Help please?

    Settings>Store...tap the ID shown...sign out...sign back in with the ID you want to use.
    Note: Apps are forever tied to the Apple ID used to originally obtain them. They cannot be updated using any other Apple ID other than the one they were originally obtained with.

  • Why can't you guys make the name bit short/stylish...

    I am very much impressed with the new SKYPE for Business look and feel. And am using this for business purposes regularly ..  But what i don't like is its long name..why can't you guys make the name bit short/stylish/convenient ?..will be difficult to say every time that i am using "Skype for business....."..  Please make these short and impressive !!!..

    Thank you for your feedback! I will pass this on internally.
    What are your thoughts about this forum? Let us know by doing this short survey.

  • How can I edit or change the name of a bookmark in the bookmark library window?

    How can I edit or change the name of a bookmark in the bookmark library window? I can figure out just about everything else I can do in the window, but can't seem to edit a bookmark.
    thank you

    In the Bookmarks Manager you can change the properties of a bookmark in the Details pane at the bottom right.<br />
    That Info pane has a More/Less button to show or hide extra properties.
    * You can change the Properties (including the name) of a Bookmark or Tag in the Details (Properties) pane at the bottom of the right pane in the Bookmarks Manager (Bookmarks > Show All Bookmarks: Shift+Ctrl+B) after selecting an item. You can rename a tag by selecting the Tags folder in the left panel and change the name in the Info pane at the bottom right.
    * You can make changes to a Bookmark in the Bookmarks menu drop down list or in the side bar (View > Sidebar > Bookmarks, Ctrl+B) via the Properties entry in the right-click context menu.
    * You can open a bookmark in a tab and click the yellow (blue on Mac) star in the location bar to open the "Edit This Bookmark" dialog and see in which folder a bookmark is located.

  • Can anyone tell me what the names for the apps that apear in the new tv ad "learn" ???

    can anyone tell me what the names for the apps that apear in the new tv ad "learn" ???

    Go here -> http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=376895159

  • How i can call an item that the name of the bloc is a param --URGENT--

    how i can call an item that the name of the bloc is a param
    exp:
    DECLARE
    B VARCHAR2(20);
    begin
    B:='BLOC1';
    :B.Text1:='Hello'; --- a want this

    Looks like your talking 'bout Forms, don't you?
    What you're looking for is the copy built-in, syntax is e.g.
    COPY ('MY TEXT', 'EMP.ENAME');

  • How do I get messages to go back to an AIM account? It's only seeing the iPad's Facetime email address and not seeing the old AIM account name that is on my desktop. I am using my iMac using iChat to talk to a newer iMac that doesn't have iChat.

    How do I get messages to go back to an AIM account? It's only seeing the iPad's Facetime email address and not seeing the old AIM account name that is on my desktop. I am using my iMac using iChat to talk to a newer iMac that doesn't have iChat. We had this working using Messages and Facetime (on the new machine) talking to my existing iChat account. One day last week, when Facetime rang, my kids answered on the iPad. Dang! Now it's all fouled up! The new iMac won't see my AIM account name and shows that I'm offline, because the iPad is off. We were able to call using "most recent call" in Facetime, but now I can't go and control that new iMac remotely to help with some email concerns the user is having. I'm trying to not personalize this too much, but it's grandkids talking to Grandma and Mom and Dad trying to solve new machine hiccups. Normally, I could just go in via iChat and control the other machine and troubleshoot, but I can't do it with Facetime only. My buddy list doesn't see  the other computer even though we are connected on Facetime right now. My name is not highlighted for the other computer. What could have gone so wrong?
    Any help would be appreciated.

    How do I get messages to go back to an AIM account? It's only seeing the iPad's Facetime email address and not seeing the old AIM account name that is on my desktop. I am using my iMac using iChat to talk to a newer iMac that doesn't have iChat. We had this working using Messages and Facetime (on the new machine) talking to my existing iChat account. One day last week, when Facetime rang, my kids answered on the iPad. Dang! Now it's all fouled up! The new iMac won't see my AIM account name and shows that I'm offline, because the iPad is off. We were able to call using "most recent call" in Facetime, but now I can't go and control that new iMac remotely to help with some email concerns the user is having. I'm trying to not personalize this too much, but it's grandkids talking to Grandma and Mom and Dad trying to solve new machine hiccups. Normally, I could just go in via iChat and control the other machine and troubleshoot, but I can't do it with Facetime only. My buddy list doesn't see  the other computer even though we are connected on Facetime right now. My name is not highlighted for the other computer. What could have gone so wrong?
    Any help would be appreciated.

  • Started a similar string before.  When I select a recipient in Messages on my Macbook Pro the name shows up in red and says the recipient is no longer registered on iMessage.  I know that they are registered.  Is there a problem with Contacts?

    Started a similar string before.  When I select a recipient in Messages on my Macbook Pro the name shows up in red and says the recipient is no longer registered on iMessage.  I know that they are registered.  Is there a problem with Contacts possibly.  The previous help has been appreciated but the problem persists.

    Hi,
    Try iMessaging your own iPhone and see if your account is actually logged in.
    It can appear "enabled" and On line but sometimes it is not.
    Also try sending from your iPhone (number) to your Apple ID and see if it gets to the Mac.
    If it does not use the Sign Out button.
    Then shut down the Mac
    On restart add back the Apple ID to the iMessages account settings.
    I also just checked My wife's iPhone as she popped up red.
    It turned out her iPhone did not have Messages On.
    10:00 pm      Tuesday; January 28, 2014
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • I accidentally set up my new ipad in itunes under the name of my existing ipad and need to set it up as a new device. Help. I cannot find a way to start fresh.

    I accidentally set up my new ipad in itunes under the name of my existing ipad and need to set it up as a new device. Help. I cannot find a way to start fresh.

    That's probably not a good idea to try to share apps since you will have to switch ID's each time you update apps and sync apps from iTunes.
    And technically - according to Apple's terms - you cannot share apps using different ID's. You can actually lock yourself out of an ID for 90 days if you switch ID's and if you associate the iPad with another ID.
    The bold type is a copy and paste from the site that I referenced below.
    When you turn on iTunes Match or Automatic Downloads, or when you download past purchases on an iOS device or computer, that device or computer becomes associated with your Apple ID. This article describes how to manage these associations.
    http://support.apple.com/kb/ht4627

  • Hi, can someone help me, I did my first page in Muse, and I did just for computer, I need to do for tablet and phone, I have to do?  thx

    Hi, can someone help me, I did my first page in Muse, and I did just for computer, I need to do for tablet and phone, I have to do?  thx
    Esto puede ser en español? por favor

    Hello,
    Please refer to the links below, you will find them very useful.
    Adobe Muse Help | Creating a website for Mobile devices
    How to create a mobile website with Adobe Muse | Adobe Muse CC tutorials
    Video Tutorials:
    Design for mobile first | Adobe Muse CC tutorials
    Mobile best practices | Adobe Muse CC tutorials
    Plan your mobile site | Adobe Muse CC tutorials
    Preview your mobile site | Adobe Muse CC tutorials
    How to create a mobile website with Adobe Muse | Adobe Muse CC tutorials
    Regards
    Vivek

  • I bought iPad air. How can I download for free the app : iPhoto, iMovie, Pages, Numbers and Keynote?

    I bought iPad air. How can I download for free the app : iPhoto, iMovie, Pages, Numbers and Keynote?

    Before you can download free apps:
    1. Make sure you are using IOS 7 (ignore)
    2. Make sure your iPad is registered in My Support Profile.
    https://supportprofile.apple.com/
    3. Try downloading again; it should be free.
    If you need serial number, it's here:
    Settings>General>About

  • Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Ever since I updated to the IOS 6, I no longer can play my music in the car!  It is plug and play!  It just sits there saying connecting and nothing happens.  A few of my friends have said the same thing.  Help please!  Any ideas?

    Ever since I updated to the IOS 6, I no longer can play my music in the car!  It is plug and play!  It just sits there saying connecting and nothing happens.  A couple of my friends have said the same thing.  Any ideas?  Help please!

    Hello ..do you have a history on the phone? did you get it wet? was it dropped? have you been using an authentic ORIGINAL apple charging cable?
    this problem occurs when there is a short circuit  in the phone... you  most likely got  it wet at some point and maybe didnt even realize it? The moisture in the phone hasb probablly  oxidized one or several capacitors, integrated chips thereby short circuiting the phone. that is why he phone  is acting erratic because these short circuits inadvertently "activates" other circuits.. eventually the phone will not turn on anymore- the heat will stress the citcuit board and you will have discontinuity along your main power lines and the phone will cease to function..i see this alllll the time in our shop
    the fact you upgraded to ios6 will even work the phone harder because its a more powerful operating system taking full advantage of the A4 chip..

  • How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes. And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes.
    And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    Are you just asking because you want to know, or do you have a problem you need to solve? I don't know how to write a program, but I think what your are describing is not an unusual thing for a  program to do. The * tells you that changes have been made since the last save, and the program reserves a portion of memory for undo functions. I suppose a coder could tell you how it works, but I don't think it would help an average user to know, but that's just my opinion.

Maybe you are looking for

  • Podcasts have stopped downloading on my iPhone.

    I just get a message saying 'Download error. Tap to retry' and no explanation beyond that. Any ideas? I saw someone had a problem with downloads and cleared podcasts, but I tried that and still have the same problem. Thanks very much in advance. Nick

  • What's best strategy for dealing with 40+ hours of footage

    We have been editing a documentary with 45+ hours of footage and presently have captured roughly 230 gb. Needless to say it's a lot of files. What's the best strategy for dealing with so much captured footage? It's almost impossible to remember it al

  • Update termination when creating delivery in ECC 6.0 system

    Hi Issue: Update termination occured when creating a delivery with Order rederence from VL01N in ECC 6.0. Created a delivery from VL01N and press 'pack' button and saved. I received a message 'Delivery XXXXXXXX is created' and then when i ran VL03N i

  • MacBook Pro (with Retina Display) Question

    I was wondering if the MacBook Pro's (with Retina Display) RAM and/or Flash storage can be upgraded by an Apple employee in-store at the time of purchase?

  • How do I install Mac os X ?

      I have a PowerBook(Firewire) Power PC G3. I using os 9.2.2, but I want to upgrade to Mac os X. Now, I'm a new user and I don't know a lot about computers. But, I am eager to learn. I need your help. Could someone explain to me (like I was a two yea