Description:
In this video, I dive into the concept of 'TOP (1) WITH TIES' in SQL Server and address some questions from viewers who still had doubts about why it might return more than just one row. We explore how the lack of an order by clause leads to errors, and then delve into scenarios where ties are broken or not, using a practical example with post type IDs. I also highlight the importance of understanding tie breakers and introduce the 'DENSE_RANK()' window function as a tool for better comprehension of how ties are handled in queries. If you enjoyed this content or found it helpful, consider supporting my channel by becoming a member or leaving a like and comment. For those looking to dive deeper into SQL Server performance tuning, I offer training courses and consulting services that can help optimize your database environments.
CHAPTERS
00:00:00 - Introduction
00:00:29 - Understanding Top One with Ties
00:03:12 - Supporting the Channel
00:05:30 - Query Without Order By
00:06:43 - Breaking Ties Early or Late
00:08:45 - Using Dense Rank Function
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? TRAINING & COURSES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Get AI-Ready With Erik
https://training.erikdarling.com/get-ai-ready-with-erik?coupon=AIREADY
SQL Server Performance Engineering Course
https://training.erikdarling.com/sql-server-performance-engineering?coupon=ENGINEERING
Learn T-SQL with Erik
https://training.erikdarling.com/learn-t-sql-with-erik?coupon=ADVANCEDTSQL
Everything Bundle:
https://training.erikdarling.com/?coupon=SPRINGCLEANING
━━━━━━━━━━━━━━━━━━━━━━━━━━
????️ CONSULTING & SERVICES
━━━━━━━━━━━━━━━━━━━━━━━━━━
Need SQL Server performance help?
https://training.erikdarling.com/sqlconsulting
━━━━━━━━━━━━━━━━━━━━━━━━━━
???? CONNECT
━━━━━━━━━━━━━━━━━━━━━━━━━━
Ask questions at Office Hours
https://erikdarling.com/officehours/
Become a channel member
https://www.youtube.com/@ErikDarlingData/join
━━━━━━━━━━━━━━━━━━━━━━━━━━
Share this link via
Or copy link














































