sqlsunday.com

T-SQL tips and tricks, best practices and query plans from the field.

Skip to content
  • sqlsunday.com
    • About
  • Structured Concepts
    • Master data tool
    • Send passwords
  • Slack app
  • Presentations
  • Downloads
  • Checklists
    • Installing SQL Server 2014
    • Installing SQL Server 2016
    • Installing SQL Server 2017
    • Installing SQL Server 2019
    • Installing SQL Server 2022
    • Links and utilities
Search

eliminate

Using DELETE on subqueries and common table expressions

2013-10-272013-09-30 / Daniel Hutmacher / Leave a comment

Here’s an interesting feature I found in the code of a colleague the other day. A common task in T-SQL is eliminating duplicate records. This became a lot easier with the introduction of windowed functions way back in SQL Server 2005, such as ROW_NUMBER(), but it turns out, I’ve still been missing out on a really simple and cool solution.

Continue reading →

Microsoft Most Valuable Professional
  • Mastodon
  • WordPress
  • LinkedIn
  • Twitter
  • Facebook
  • GitHub
  • RSS Feed

Search

Categories

  • By difficulty (201)
    • Advanced (42)
    • Basics (58)
    • Intermediate (103)
  • CLR (1)
  • Code review (1)
  • Datasets (1)
  • Off-topic (14)
  • Rant (6)
  • Scripts (20)
  • Series (33)
    • Efficient data (10)
    • Introduction to T-SQL (1)
    • Slowly changing dimensions (5)
    • SQL Server security (17)
  • SQL Server concepts (85)
  • T-SQL (148)
  • Tips (59)
  • Uncategorized (1)
  • Videos (2)
Daniel Hutmacher, Structured Concepts AB

SQL SERVER HELP YOU CAN DEPEND ON.

Need SQL Server help?

At Structured Concepts, we specialize in SQL Server development and performance tuning, as well as technical training for users and developers.

Visit our homepage at strd.co.

Mastodon
Create a website or blog at WordPress.com
  • Follow Following
    • sqlsunday.com
    • Join 184 other followers
    • Already have a WordPress.com account? Log in now.
    • sqlsunday.com
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar