Home All Groups Group Topic Archive Search About

Select distinct problems

Author
18 Dec 2006 7:49 PM
Beau D'Amore
Here's my issue
========
history table to select from has the following columns:

Acct_id, Threshold, DateCreated

In this table, there are multiple rows that contain the same Acct_id &
threshold but all DateCreated dates are different.
(its a history table as well as the reference for the last threshold)

I need to select the last Acct_ID/Threshold combo per Acct_id.
(Need the last threshold entered for each acct_id)

I have:
SELECT DISTINCT GA_type_id, threshold, date_created AS DateCreated
FROM         GA_Acct_Reset_History
GROUP BY GA_type_id, threshold, date_created
(gets all kinds of multiple rows... might as well not ever have 'DISTINCT'
in the query it does nothing)

I tried:
select distinct A.GA_type_id, a.threshold from GA_Acct_Reset_History A
inner join GA_Acct_Reset_History b ON
a.ga_type_id = b.ga_type_id
DIDNT WORK EITHER...

Help? (I know it's simple too)

p.s. Can't change schema

AddThis Social Bookmark Button