User Profile

Collapse

Profile Sidebar

Collapse
shawpnendu
shawpnendu
Last Activity: Aug 6 '09, 05:21 AM
Joined: Jun 1 '09
Location: Dhaka, Bangladesh
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • shawpnendu
    replied to SQL Query - Eliminating Duplicates
    I think OriginalAcctNo is the key to filter. So you can try with below query:
    Code:
    SELECT MAX(AccountNo),OriginalAcctNo FROM tbl 
    GROUP BY  OriginalAcctNo
    Now check what the query return.
    If successfull then delete in the following way:
    Code:
    DELETE FROM tbl where AccountNo NOT IN
    (SELECT MAX(AccountNo) FROM tbl 
    GROUP BY  OriginalAcctNo)
    Regards
    See more | Go to post
    Last edited by NeoPa; Jun 2 '09, 11:46 AM. Reason: Please use the [CODE] tags provided.

    Leave a comment:


  • shawpnendu
    replied to date format
    Within SQL Server you have to use the below format:
    CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

    But keep in mind no style will return you expected result. So what you can do? You must make the query in below way:

    SELECT CONVERT(VARCHAR (3),GETDATE(),7 )+', '+RIGHT('0' + RTRIM(DAY(GETDA TE())),2)+' '+ CONVERT(VARCHAR ,Year(GETDATE() ))

    Here I didn't add the time portion. Add time portion...
    See more | Go to post
    Last edited by Frinavale; Jun 2 '09, 04:29 PM. Reason: Removed signature link: not relevant to question (spam). Post was originally in all caps, I converted it to normal case.

    Leave a comment:


  • After save according to the previous poster you can read the below post which will help you a lot:
    http://www.devcity.net/Articles/128/1/article.aspx

    Regards
    <link removed>...
    See more | Go to post
    Last edited by Frinavale; Jun 1 '09, 03:07 PM. Reason: Link to personal blog removed. Reason: not relevant to question.

    Leave a comment:

No activity results to display
Show More
Working...