![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| Sponsored Links |
| ||||
| See if this works: Code: SELECT DISTINCT(ManualTypeID),
ManualID,
ProductID,
ManualPartNumber,
ManualDescription,
ManualRevision
FROM tblManuals
ORDER BY ManualID DESC
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
| ||||
| That will not work because several different manuals can have the same ManualTypeID. I wonder if I just select based on unique ManualPartNumber? I don't think anyone can enter a duplicate Part Number... hmmm. Thanks for the clue. |
| ||||
| use MAX and GROUP BY Code: SELECT ManualTypeID, ProductID, ManualPartNumber, ManualDescription, MAX(ManualRevision) FROM tblManuals GROUP BY ManualTypeID, ProductID, ManualPartNumber, ManualDescription
__________________ Quote of the Month: Strife: As long as we have each other, we'll never run out of problems. Questions to Ponder: Should vegetarians eat animal crackers? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright © 2008 sbenj69 |
| ||||
| The problem comes if you need the ManualID for some reason, since if you included that in your GROUP BY, you get every record (natch). To get the full record: Code: SELECT a.* FROM tblManuals A
JOIN
(SELECT ManualTypeId, Max(ManualRevision) as Latest
FROM tblManuals
GROUP BY ManualTypeId) B
ON (a.ManualTypeId = b.ManualTypeId
AND a.ManualRevision = b.Latest)
|
| ||||
| Okay, I am running into some difficulties. Here is my original SQL that grabs EVERY revision for each ManualPartNumber: Code: strSQL = "SELECT m.ManualID, m.ManualName, m.ManualApplication, m.ManualPartNumber, m.ManualSerialStart, m.ManualSerialEnd, m.ManualRevision, " & _ "m.ManualIteration, m.ManualPublished, m.ManualPublishedDate, u.UserName, p.ProductName, mt.ManualTypeName " & _ "FROM tblManuals m " & _ "LEFT JOIN tblUsers u ON m.ManualPublisher = u.UserID " & _ "LEFT JOIN tblProducts p ON m.ProductID = p.ProductID " & _ "LEFT JOIN tblManuals_types mt ON m.ManualTypeID = mt.ManualTypeID " & _ "WHERE 1 = 1" & _ strProdID & _ strManualTypeID |
| ||||
| I would think you would only need to group by ManualPartNumber in this case. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Connection String & Record Set Functions | mehere | Classic ASP | 0 | March 21st, 2008 12:07 PM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |