How do you put two selects in a query, and add/change a column too?
An example of what I’m trying to do is hopefully explained below.
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)
Try using case :