CREATE PROCEDURE GetSMSSTop3
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
AS
SELECT TOP 3 * FROM SMSS WHERE Topic = 'ST' ORDER BY CODate DESC
UNION
SELECT TOP 3 * FROM SMSS WHERE Topic = 'SL' ORDER BY CODate DESC
UNION
SELECT TOP 3 * FROM SMSS WHERE Topic = 'CM' ORDER BY CODate DESC
/* SET NOCOUNT ON */
RETURN
不行啊,为什么?
select top 3 topic,date from table where topic = 'ST' order by date DESC
UNION
select top 3 topic,date from table where topic = 'SL' order by date DESC
UNION
select top 3 topic,date from table where topic = 'CM' order by date DESC