Tricky SQL question

From: A&B <cassandra_sharpe_at_merck.com>
Date: Wed, 21 Mar 2001 17:51:17 -0500
Message-ID: <99bb96$ktt$1_at_merck.com>


I need to create a sql statement that select a specific number of records from a table for each unique value within a column.

For example.... I have a table that stores news articles. Every news article has a type( headlines, health, comics, etc ). I need to select two news articles from the table for every news type. If there are 10 unique news types in the table, then I need to select two records for every type in the table.

We tried using UNION but there are over 200 types and the sql statement was greater than 4000 characters!

If anyone can help, I would appreciate it.

       The contents of this message express only the sender's opinion.
       This message does not necessarily reflect the policy or views of
       my employer, Merck & Co., Inc.  All responsibility for the statements
       made in this Usenet posting resides solely and completely with the
       sender.
Received on Wed Mar 21 2001 - 23:51:17 CET

Original text of this message