Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by DrDik

  1. DrDik

    difficult SQL query question

    sadly not, it still lists duplicate file_id records, ie if a file_id has 2 version the query prints out both rather than only the record with the greatest version number :( arghhhhhhh!
  2. DrDik

    difficult SQL query question

    SQL error on peter's SQL, MySQL doesn't like a.version_number in having clause, I've tried all the aliases I can think of: Here is a dump of the table with real data, it might help: DROP TABLE IF EXISTS `version`; CREATE TABLE `version` ( `id` bigint(20) NOT NULL auto_increment, `file_id`...
  3. DrDik

    difficult SQL query question

    very close..... I've tried it and it certainly works except... (you were waiting for that!) it returns for every file_id the version number rather than just a result set of file_id and max version number. In other words: where file_id=5 and there are 3 versions of file_id=5 it returns a row...
  4. DrDik

    difficult SQL query question

    Yes indeed When I run my query I can get the correct max version number but it also returns the wrong filename (of that version number). It returns the version 1 filename of the correct file_id and not (in this example) the version 3 of the correct file_id. so I would like this: 8 | 6...
  5. DrDik

    difficult SQL query question

    Hi Sorry it's hard to explain! All the rows for package_id=11 are shown (there are many other rows with different package_id's) What I want isthe max version number for each file_id. So based on file_id (file_id represents a unique file) and also on version I need the max version for each...
  6. DrDik

    difficult SQL query question

    Hi I have a table like so: id | file_id | file_repository_id | version_number | filename | package_id 7 | 5 | 7 | 1 | file1 | 11 8 | 6 | 8 | 1 | file2 | 11 9 | 5 | 9...

Part and Inventory Search

Back
Top