sql中类似三元运算符的语句

SELECT ( CASE WHEN DATENAME(QUARTER, GETDATE()) = 1
THEN DATENAME(YEAR, DATEADD(YEAR, -1, GETDATE()))
ELSE DATENAME(YEAR, GETDATE())
END );

posted @ 2017-01-13 09:50  MartialWorldFish  阅读(1690)  评论(0编辑  收藏  举报