Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at CFUNITED 2009 (Lansdowne, VA) with:

Jaden

Member since Jul 17, 2009

Recent Blog Comments By Jaden

  • Selecting Top X From Each Group

    Posted on Feb 20, 2011 at 5:58 PM

    @MCouvi Here are two examples of selecting the top n rows, with rows distributed evenly across the groups. These tables are from the MS AdventureWorksLT sample database. SQL Server 2005+ is required, since it uses a CTE and ROW_NUMBER(). This query selects across 3 groups (CountryRegion). DECLAR... read more »

  • Selecting Top X From Each Group

    Posted on Jul 17, 2009 at 12:37 PM

    For SQL Server, ROW_NUMBER() allows for a single scan of the table, which should provider better performance on larger tables, especially when filtering non-indexed columns versus a join/insert method. SELECT id, name, hair, score, ranknum FROM ( SELECT id, name, hair, score, ROW_NUMBER() OVER ... read more »