I've got a table with some duplicate entries, I've been trying different query combinations but I've been unable to solve
Here is an example of my problem
[url removed, login to view]
Basically I would like to get the last distinct value (entry id: 9634), I've got many item_id's with duplicate field_value's.
Payment will be provided as soon as confirmed as working.
I've attached the table layout, I want a query that will select the latest unique value for item_id and field_id.
So the query would display these results
entry_id field_id item_id field_value
2 1 1 424
4 2 1 432434
6 1 2 4324
8 2 2 4324324
I can pay with Paypal once I confirm code is working as I want. So far I'm using this query
SELECT DISTINCT field_id, item_id, MIN(entry_id) as entry_id, MIN(field_value) as field_value FROM values2 WHERE item_id!='0' GROUP BY field_id, item_id ORDER BY item_id, field_id ASC
but that is pulling the first distinct values not the latest/last distinct values like I want.
5 pekerja bebas membida secara purata $63 untuk pekerjaan ini
I've got a couple of solutions here for you, one that I have optimised for speed, and the other for usability. I'm a SQL DBA and MCSD - I'm pretty good at this kind of stuff.