Jason Brimhall


Blog Post

May I help you?

With the Vancouver games underway, I have been reflecting on the 2002 Winter Olympic Games.  Those were the greatest winter...

2010-02-18

823 reads

Blog Post

DBA.Sleep(8hrs)

I have been pondering recently what helps me to sleep at night.  Or, conversely, what prevents me from sleeping at...

2010-02-17

1,326 reads

Blog Post

In Vs. Inner Join

This is tightly related to another of my forays into tuning some slowly/poorly performing processes.  This process came across my...

2010-02-16

872 reads

Blog Post

PayPeriod II

I recently blogged about a solution I had decided to use in order to solve a problem related to PayPeriod...

2010-02-14

796 reads

Blog Post

Relationships

This month Rob Farley is hosting TSQL-Tuesday #3.  The topic is Relationships and he has left it wide open for...

2010-02-09

881 reads

Blog Post

Key Discovery III

Recursively traverse system views to build a Hierarchical Perspective into the database.
Related Posts:

T-SQL Tuesday Participation Over the Years December 19, 2018

T-SQL Tuesday #104: Just Can't Cut That Cord...

2010-02-02

9 reads

Blogs

The Book of Redgate: Profits

By

Redgate is a for-profit company. We look to make money by building and selling...

Session Materials for Techorama & DataGrillen 2026

By

I’ve uploaded the slides for my Techorama session Microsoft Fabric for Dummies and my...

Stop Using Pandas for Aggregations — Try DuckDB Instead

By

If you've ever loaded a 2 GB CSV into pandas just to run a...

Read the latest Blogs

Forums

Even When You Know What You're Doing, You Can Screw Up

By Grant Fritchey

Comments posted to this topic are about the item Even When You Know What...

The New Software Team

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The New Software Team

Database Mail in SQL Server 2022

By Abdellateef Ibrahim

Comments posted to this topic are about the item Database Mail in SQL Server...

Visit the forum

Question of the Day

The string_agg function

We create the following table and then insert some records in it:

create table t1 (
   id int primary key,
   category char(1) not null,
   product varchar(50)
);

insert into t1 values
(1, 'A', 'Product 1'),
(2, 'A', 'Product 2'),
(3, 'A', 'Product 3'),
(4, 'B', 'Product 4'),
(5, 'B', 'Product 5');
What happens if we execute the following query in both Sql Server and PostgreSQL?
select id, 
category, 
string_agg(product, ';')
                 over (partition by category order by id
                 rows between unbounded preceding and unbounded following) as stragg
from t1;

See possible answers