jamesm6162
01-22-2008, 08:56 AM
Hi
I'm trying to create a view containing 3 fields, all from the same table.
Here's what I have:
SELECT MAX(dateField), field2, field3
FROM table1
GROUP BY field2, field3
Basically I want the highest dateField for each field2, and then just add the corresponding field3 next to it. But this query doesnt give me unique values for field2
If I leave the field3 out of the query as follows:
SELECT MAX(dateField), field2
FROM table1
GROUP BY field2
then I get unique field2 values, but i dont have the corresponding field3 value.
How should I rewrite this query to achieve what i'm trying to?
Thanks
I'm trying to create a view containing 3 fields, all from the same table.
Here's what I have:
SELECT MAX(dateField), field2, field3
FROM table1
GROUP BY field2, field3
Basically I want the highest dateField for each field2, and then just add the corresponding field3 next to it. But this query doesnt give me unique values for field2
If I leave the field3 out of the query as follows:
SELECT MAX(dateField), field2
FROM table1
GROUP BY field2
then I get unique field2 values, but i dont have the corresponding field3 value.
How should I rewrite this query to achieve what i'm trying to?
Thanks