November 30, 2004 at 1:28 pm
Trying to create a stored proc that just returns an ID column and not the date column I need for the criteria.
tblLASER_CHAR stores system characterizations. Each system may have multiple characterizations. Systems are uniquely identified by both SYSTEM_SN and SYSTEM_WO. Given the SN and WO of a system I want the most recent characterization.
The following is wrong but kind of represents what I want to get:
CREATE PROCEDURE [dbo].[sp_GET_LASER_CHAR_ID]
@SYS_SN [char](10),
@SYS_WO [char](10)
AS
SELECT LASER_CHAR_ID
FROM dbo.tblLASER_CHAR
WHERE (SYSTEM_SN = @SYS_SN) AND (SYSTEM_WO = @SYS_WO) AND (STATUS = 'CLOSED ')
GROUP BY LASER_CHAR_ID
HAVING MAX(CREATE_DATE)
Sean Wyatt
seanwyatt.com
November 30, 2004 at 1:31 pm
many different ways of doing this...
try
select top 1 columnname from tablename where ... order by ...
November 30, 2004 at 1:39 pm
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply