gemmo - 1 year ago 113

SQL Question

Hi I have two columns which I concatenate A&B, this is done to figure out the customer ID.

I need to then do a case statement on that calculated field.

Can it be done in one go?

`Column A`

Column B

Column C = Column A & Column B

Column D = Case When (column C) = 001-002 then XXXX

Column D is not working. The question is if column C is a calculated field, can I then calculate off column C to give column D, in a single query?

Thanks

Answer Source

You should do it in this way...as calculated columns is not going to help in further calculation

```
Column A
Column B
Column C = Column A & Column B
Column D = Case When (Column A & Column B) = 001-002 then XXXX
```