You are here:   Articles
Register   |  Login

Programming Articles

Minimize
26

A common Sql problem is getting the first record of each set of records with a duplicate value in a column.

For example, suppose you have a set of orders with email addresses. You want to email each person, but you do not want to send them multiple emails.

Here is some Sql you can use to solve the problem.

By Andrew Weitzen, Bronze Inc. (c) 2010

Bronze is the publisher of several online Internet journals including: InternetHandholding.com, DomainNames.gs, DotNetNuke.bz, Programmer.bz, Software.vg, WebHosting.vg

select email, min(idorder) as idorder
from orders
group by email
Posted in: Sql

Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

Programmer Newsletter

Minimize

Subscribe to the Internet Handholding newsletter



Reccomend Programmer.bz

Minimize

Share/Bookmark Bookmark and Share