[RESOLVED] Complex SQL Filter
I'm just after any thoughts or idea's about how I could approach this problem. It's got me stumped, but then again, I'm not an SQL wizard. :o
My table records the history of individual items as they change over the course of a project, so it may have three records of the same item with different "Upload numbers," and hense different stats.
My employer wants to be able to filter the table to show every item of a specific statistic (eg. All records where Area Number = ?).
Under normal circumstances this would be easy: "WHERE [Area] = ?".
But they don't want the table to be cluttered with the previous history items: they only want the latest items (those with the highest Upload Numbers). Add to this the fact that each upload may be of a small section of items, or of every item, or any selection of items they want, and you can see that the latest upload number may be different for each item.
In short, I need to filter by every record where [Area] equals user input, AND where the [Upload #] field is the highest of all records with the same [Item ID].
The end product will be displayed in a datagridview in C# Pro 2008 (but SQL is the same in VB, so that shouldn't matter). The database is 2003 Access, the connection OleDb.
Any ideas? Any help is appreciated. :wave:
Thanks,
Qu.