Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
Get the latest record of a set |
Thu, Oct 25 2007 8:41 AM | Permanent Link |
"Juan J Velazquez Garcia" | Hello,
For two tables: PRODUCTION_ORDER (ID, DUE_DATE, ID_STATUS , OPEN) STATUS (ID, DATE, STATUS) The status table stores a history of production order's status. How can I get the latest status for a production order. SELECT PO.ID, PO.DUE_DATE, S.DATE, S.STATUS FROM PRODUCTION_ORDER PO, STATUS S WHERE OPEN=TRUE AND PO.ID_STATUS=S.ID But I want only the latest Status. Thanks in advance, Juan -- |
Fri, Oct 26 2007 3:57 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Juan,
<< How can I get the latest status for a production order. >> Try this: SELECT PO.ID, PO.DUE_DATE, S.DATE, MAX(S.STATUS) AS STATUS FROM PRODUCTION_ORDER PO, STATUS S WHERE OPEN=TRUE AND PO.ID_STATUS=S.ID GROUP BY ID, DUE_DATE, DATE -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |