Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Stop duplicates returning in a recordset


Message #1 by duncan.faulkner1@b... on Tue, 11 Mar 2003 13:59:15
Hi Guys,

I've got an SQL Query thats giving me grief and I was wondering whether 
someone might be able to help.

I've got two tables with a primary key / foreign key releationship the 
tables are named policy and letters. The problem I'm having is that there 
can be more than one record in the letters table with the same with the 
same ID in the letters table, I only want to return one of these records 
that, I have tried using distinct, but because one of the select criteria 
is a date, that can be different, though the rest of the information is 
identical both records are returned as the dates are different and SQL 
Server rightly say's that these are not duplicates, I can't remove the 
date from the select criteria as the client wants to see the date. Is 
there a way of checking or enforcing that only the latest dated record is 
brought back.

This is kinda urgent, thanks in advance

Duncan

  Return to Index