[thelist] SQL Distinct to 1 item

Joshua Olson joshua at waetech.com
Fri Jun 17 10:04:17 CDT 2005


> -----Original Message-----
> From: j s
> Sent: Friday, June 17, 2005 9:45 AM
> 
> Hello,
>  
> In ASP I'm using a SQL line that pulls data from a few 
> tables.  Is there a way to use Distinct (or something like 
> it) and apply it to only 1 field instead of the whole record? 
>  I'm getting duplicates - but if I could distinct on the 
> "File_Number" it would solve my problems.

Jess,

Unfortunately, using distinct takes into account every field, and there's no
way around that.

Looking at your query, it appears that each of the joined tables (Employees,
Mexican_Cities, File_Status, and Adjusters) is related to the main
Vehicle_Files table in a 1-1 relationship and that File_Number is the PK of
the Vehicle_Files table.  Is this correct?  If it is, then DISTINCT should
be returning only one record for each record in Vehicle_Files.

Would you mind providing a snippet of the resultset (don't include all the
extraneous fields) that shows the issue you are having?

<><><><><><><><><><>
Joshua L. Olson
WAE Tech Inc.
http://www.waetech.com/
Phone: 706.210.0168 

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/




More information about the thelist mailing list