> SELECT MAX(A) AS A, B, C
> FROM T
> GROUP BY B
> 

This is an invalid SQL statement (SQLite should generate an error here).

The correct(tm) way to do this is with subqueries.

ORACLE SQL (and others), using subqueries, you would use...

select * from t
where (a, b) in (select max(a), b from t group by b);

However - SQLite does not support that (two elements in an "in" clause) :-( 

Can you hash the two columns to give one as such (or similar)?....

> 

select * from t
where ((a * 100000) + b) in (select (a * 100000) + max(b)
                            from t group by b);



which should give you what you want if you can.


Eddy



Reply via email to