如何在查询中放置两个选择,并添加/更改列?希望在下面解释我正在尝试做的一个例子。
Ex: Table [TESTS]
TESTID TEST
1 Login
2 Password
3 Create Account
4 Edit Account
5 Close Account
Would like to end up with a query result:
TestType TESTID TEST
Init 1 Login
Init 2 Pasword
Func 3 Create Account
Func 4 Edit Account
Func 5 Close Account
/* This doesn't work: */
select 'Init' as [TestType], TESTID, TEST from TESTS where (TESTID >= 1 AND TESTID <= 2)
select 'Func' as [TestType], TESTID, TEST from TESTS where (TESTID >= 3 AND TESTID <= 5)