I know that "distinct" effects the whole string of fields after it, but in this case, I want "distinct" to apply only to the ul.CompID field and not the others but I also want the latest ul.UpdateDate entry. Can someone help or at least tell me if this is possible or do I need more scripting outside the select statement to do it?
[tt]select distinct ul.CompID as PropertyID, Email, RealName, c.CompBuildingName
as BuildingName, ul.UpdateDate as UpdateDate from UpdateLog ul
left join users on UserID=AcctID
left join Comp c on c.CompID=ul.CompID
where UserID = 100 and ul.CompID <> 0
order by c.CompBuildingName, ul.UpdateDate desc[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)
[tt]select distinct ul.CompID as PropertyID, Email, RealName, c.CompBuildingName
as BuildingName, ul.UpdateDate as UpdateDate from UpdateLog ul
left join users on UserID=AcctID
left join Comp c on c.CompID=ul.CompID
where UserID = 100 and ul.CompID <> 0
order by c.CompBuildingName, ul.UpdateDate desc[/tt] Don
don@pc-homepage.com
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT/2000 (only when I have to!)