Archive for March 22nd, 2009
Selecting non-unique rows
Sometimes we need to select all rows for a table that have duplicate values in some of the columns. Like, we want to select all user comments for all posts commented by more than one user.
If there are two or more comments for a post, we select all comments for this post; if there is only one comment, we select none.
Let's create the sample tables to illustrate our needs:
Read the rest of this entry »