sql中类似三元运算符的语句
SELECT ( CASE WHEN DATENAME(QUARTER, GETDATE()) = 1
THEN DATENAME(YEAR, DATEADD(YEAR, -1, GETDATE()))
ELSE DATENAME(YEAR, GETDATE())
END );
SELECT ( CASE WHEN DATENAME(QUARTER, GETDATE()) = 1
THEN DATENAME(YEAR, DATEADD(YEAR, -1, GETDATE()))
ELSE DATENAME(YEAR, GETDATE())
END );