Please support our MySQL advertiser: Programming Forums
•
•
Join Date: Jun 2005
Posts: 39
Reputation:
Rep Power: 4
Solved Threads: 0
Hey there,
i have a table in MySQL that is updated about every 5 minutes with about a hundred new records. For an application i am building, i only need the info from the most recent entry for each specific unit. But, i need all of the info in that row.
i was going to use DISTINCT like this,
it gives me only the last record for each unit, but only returns the UnitNumber and i need all of the colums for each UnitNumber that it gives me.
or if i use something like this, will it only pull out items that have only one entry of each?
or is there a better way?
thanks
i have a table in MySQL that is updated about every 5 minutes with about a hundred new records. For an application i am building, i only need the info from the most recent entry for each specific unit. But, i need all of the info in that row.
i was going to use DISTINCT like this,
SELECT DISTINCT UnitNumber FROM table ORDER BY `autoinc` DESC
it gives me only the last record for each unit, but only returns the UnitNumber and i need all of the colums for each UnitNumber that it gives me.
or if i use something like this, will it only pull out items that have only one entry of each?
select distinct UnitNumber, value1, value2 from table order by autoinc desc
or is there a better way?
thanks
Similar Threads
Other Threads in the MySQL Forum
- UNIQUE vs. DISTINCT (Database Design)
- C++ Identifiers and Keywords (C++)
- How to list the record orderby id when selecting distinct (Visual Basic 4 / 5 / 6)
- Analyze server logs (Linux Servers and Apache)
- VMware Help !! (*nix Software)
- C++ and AI (C++)
Other Threads in the MySQL Forum
- Previous Thread: Error with Update
- Next Thread: Preety straightforward!
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Threaded Mode