例如,我们假设有一个这样的表:
ID Food
-- ----
1 Fruit
所以无论什么时候说Fruit,我想把它分成3行:
ID Food
-- ----
1 Apple
1 Banana
1 Orange
任何提示?
答案 0 :(得分:3)
select t.id, coalesce(a.alt, t.food) as food
from t outer apply
(select alt
from (values ('Apple'), ('Banana'), ('Orange')) v(alt)
where t.food = 'Fruit'
) a;
答案 1 :(得分:0)
SELECT *
FROM TABLE1
WHERE CreationDate >= '12/12/2015' AND CreationDate <= '12/12/2015 23:59:59'