我正在尝试构建以下 sp :
USE [MarMoniApp]
GO
/****** Object: StoredProcedure [dbo].[Desc_by_date] Script Date: 10/23/2012 09:01:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Desc_by_date]
@DateToSearch varchar(50)
AS
BEGIN
select a.ticker,a.First_T, a.Last_T, a.Size_mln, a.pct_d_vol,a.a_trad,a.coolname,a.recency,b.Analyst
from Order_Desc a
CASE
When a.coolname = 'ELTORO'
then (Inner join MarMoniApp.dbo.Namelist b on a.ticker = b.ticker )
END
where convert(datetime, cast(rtrim(First_T) AS nvarchar)) > DateToSearch
order by CONVERT(DATETIME, cast(rtrim(First_T) AS nvarchar) ) DESC
END
我只想在“coolname”等于 eltoro 的情况下进行内部连接,但我的语法似乎不正确。