Archive for June, 2008

Addressable

We work with a large variety of URIs at Berkman. But I’ve been haveing difficulties using the URI library. Many times it would throw the URI::InvalidURIError when in fact I was parsing a valid web address or perhaps some text containing a valid web address. Today I came across an extension to the URI ruby library called Addressable. The heuristic_parse method is making my life a happier one.

Add comment June 19th, 2008

Remove Duplicate Rows

I often find the need to check for duplicates in the database. This is not an intuitive SQL command to create off the top of your head as it involves Group By and the rarely used Having clause. Since I’m always looking it up, I thought I’d post it here.

The code below will identify which rows have duplicate values based upon two primary key columns:

SELECT col1, col2, count(*)
FROM t1
GROUP BY col1, col2
HAVING count(*) > 1

If you need to go a step further and remove duplicate rows, there’s a great Microsoft blog article that will walk you through the process:

How to remove duplicate rows from a table in SQL Server

Add comment June 12th, 2008


RSS Berkman Gender & Tech

RSS Tweets

Tags

Meta