You don't have a key field, which might make things easier. Also, it's unstated in your question, but it seems you're looking for the earliest of the matching NULL/NULL records when there's more than one, yes? Off the top of my head, I'd try something like this (not tested):
select RegDate, Firstname, Lastname, Email from dbo.LitRequest where coalesce( firstname,'' ) <> '' and coalesce( lastname,'' ) <> '' UNION select min( regdate ), firstname, lastname, email from dbo.litRequest where firstname is null and lastname is null and coalesce( email,'' ) <> '' group by firstname, lastname, email On 10/30/06, Duane <[EMAIL PROTECTED]> wrote: > > I have a SQL question for anyone willing to help me get my head unstuck. > > I have the following sample data: > > RegDate FirstName LastName Email > 10/1/2006 NULL NULL [EMAIL PROTECTED] > 10/2/2006 NULL NULL [EMAIL PROTECTED] > 10/2/2006 NULL NULL [EMAIL PROTECTED] > 10/3/2006 Fred Flintstone [EMAIL PROTECTED] > 10/8/2006 Barney Rubble [EMAIL PROTECTED] > 10/9/2006 NULL NULL [EMAIL PROTECTED] > > In my returned dataset I need to get the following: > 10/1/2006 NULL NULL [EMAIL PROTECTED] > 10/2/2006 Fred Flintstone [EMAIL PROTECTED] > 10/8/2006 Barney Rubble [EMAIL PROTECTED] > > Basically I need all records that have a first and last name, and only the > null records that have a distinct email address. -- Ken -- Kenneth S. Redler [EMAIL PROTECTED] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2597 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
