Jeff's SQL Server Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server
posts - 157, comments - 2686, trackbacks - 64

My Links

Advertisement

News

Welcome to my weblog. My name is Jeff Smith, I am software developer in Boston, MA and I was recently named a 2009 SQL Server MVP. Check in frequently for tips, tricks, commentary and ideas on SQL Server and .NET programming.


Subscribe





Archives

Post Categories

Programming

Sports

SQL

October 2003 Blog Posts

Keep those SQL Crosstabs flexible!

I recently helped someone with performing some simple cross-tabs in SQL ... read more...

posted @ Friday, October 24, 2003 4:40 PM | Feedback (1) | Filed Under [ T-SQL CrossTabs / Pivoting Data Techniques ]

Comparing sets of rows from two tables

I thought I'd post a blog showing a technique I haven't seen elsewhere.  This is from a recent post of mine at the SqlTeam forums. The problem: you have two tables, each containing mutiple rows of data per “SetID”.  You need to compare the two tables to see which sets have complete matches. First, the DDL and the data: create table #t1  (SetID int not null,  Attribute varchar(10) not null,  Value int not null, constraint t1_pk primary key (SetID, Attribute)) create table #t2  (SetID int not null,  Attribute varchar(10) not null,  Value int not null, constraint t2_pk primary key (SetID, Attribute)) GO insert into #t1 select 1,'a',1 union select 1,'b',2 union select 1,'c',3 union select 2,'a',4 union select 2,'c',5...

posted @ Friday, October 03, 2003 1:59 PM | Feedback (15) | Filed Under [ T-SQL Joins/Relations ]

Powered by:
Powered By Subtext Powered By ASP.NET