sql server 2008 - sql Alias Column Name for Use in CASE Statement -
I have an SQL query as below, in the form when I execute this query, I get an exception in the form of invalid column name operator scanner, As tried by using a code in the other name in the second query, Then it always implements the other part. Please give me some tips related sangeet The main issue is that you do not reference the nickname in the same query Can give Also you have brackets and an additional You can copy the whole thing again (either fixing your query in the process): Or, to simplify: or a CTE (again Use query fixing):
selected site, data source, (as select case when data source = 'RFQ' then 'ChangeOperator' balance 'SameOperator' end) OperatorScenario, the (select case OperatorScenario = 'ChangeOperator' then '1' Balance '022' end) OperatorScenario2 As tablename
(if you choose the case 'OperatorScenario' = 'ChangeOperator' then '1' remaining '022' end) As OperatorScenario2
SELECT keyword, which looks like a subclass where I do not believe you have one intention (you have
FROM Do not block. / P>
select site, data source, case When the data source = 'RFQ' then 'ChangeOperator' remaining 'Saooperator' and SS Operator SACNRI case Switch to in case when Datasors = 'RFQ' then 'Chenjropretr' Aelsi 'Saoopretr "end =" Chenjropretr' and '1' Ielsi as '022' Eddie the Tablenm from Opretrssenario 2
select site, data source, case when the data source = 'rfQ' then 'ChangeOperator' remaining 'SameOperator' end operatorScenario, as the case when the data Source = 'RFQ' then '1' remaining '022' from Tablename as END OperatorScenario2
Select (site with CTE, Detasors case when Datasors = so 'RFQ' Chenjopretr 'EL SA' Saoopretr 'and SAS operator Sisanario, select Tablenem) site, Detasors operator Sisanario when Opretrsenario = 'Chenjropretr' and '1' Els '022' CT operator Senario 2 as Eddie
Comments
Post a Comment