Practice Activity - Retrieving the last row for each group in a table in SQL Server

  Рет қаралды 12,311

SQL Server 101

SQL Server 101

Күн бұрын

Пікірлер: 16
@Random_dudebro
@Random_dudebro 10 ай бұрын
I have been looking for a way to do this for about 3 weeks for a work project and you saved me… thank you lol
@SQLServer101
@SQLServer101 10 ай бұрын
Hi Random. I'm glad that I could help. Phillip
@krishnakamalgogoi9893
@krishnakamalgogoi9893 5 ай бұрын
with cte3 as (select *, ROW_NUMBER() over(partition by Region order by Pricedate desc) as region_rnk from tblhouseprices) select * from cte3 where region_rnk = 1
@itsgroovylue
@itsgroovylue 10 ай бұрын
You absolutely saved my day my friend!! Thank you!
@nonoobott8602
@nonoobott8602 Жыл бұрын
Absolutely brilliant. This is so useful. Thanks for sharing
@diegocosta168
@diegocosta168 Жыл бұрын
Great! Helped me a lot 👏👏👏
@minnrick7986
@minnrick7986 2 жыл бұрын
Thanks! CTE seems the most elegant to me :)
@SQLServer101
@SQLServer101 2 жыл бұрын
Thanks - I do like CTEs, as they can simplify nested subqueries - which we'll be having a look at in the next video. Phillip
@taibabs1222
@taibabs1222 2 жыл бұрын
You could also put the query into a temp table as suppose to a CTE.
@Mnfls
@Mnfls Жыл бұрын
This is 🤯
@ElWiwif
@ElWiwif Жыл бұрын
You rock!! Thanks!!
@danramirz
@danramirz 2 жыл бұрын
Thanks for this video!
@dangkhanhlinh476
@dangkhanhlinh476 Жыл бұрын
nice!
@jacekk7819
@jacekk7819 Жыл бұрын
I`m not sure why but my CTE with ROW_NUMBER is faster than other two , query plan showing me 22% , 39% , 39% for query cost
@SQLServer101
@SQLServer101 Жыл бұрын
Hi Jacek. Very interesting - it's good a) to be able to have multiple ways to do the same thing, and b) to see which is faster! Phillip
@HippoAliasSkelman
@HippoAliasSkelman 2 жыл бұрын
thanks a lot :)
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
Widgens Demo
16:12
Max Martínez Ruts
Рет қаралды 18
SQL Views Tutorial | VIEWS in SQL Complete Tutorial
43:20
techTFQ
Рет қаралды 299 М.
Querying 100 Billion Rows using SQL, 7 TB in a single table
9:07
Arpit Agrawal (Elastiq.AI)
Рет қаралды 55 М.
Intro to T-SQL - The Second Language Every Developer Should Know
1:07:07
How To Write SQL Server Queries Correctly: Case Expressions
15:01
Erik Darling (Erik Darling Data)
Рет қаралды 1,1 М.
Solving SQL Query | Rows to Column in SQL
1:13:11
techTFQ
Рет қаралды 180 М.
SQL Temp Tables
10:21
Pragmatic Works
Рет қаралды 6 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 222 М.