Link to home
Start Free TrialLog in
Avatar of LJG
LJG

asked on

Concatenate a field in a SQL statment

Is there a way to concatenate a field in a SQL statment, in a Stored Procedure, and use the the alias some place else in the same stored procedure.  In the below, I know that I can't use 'Amount_Paying', I must use another case statment.  Is there a way around using a 2nd case statement.  I know I can create a temp table, but I would like to just refer to the alias in the same SQL statment.

Thanks in advance for any help
LJG


SELECT  tbl_za_Deposit_Start.Deposit_Number,
     Amount_Paying =
        Case
                          When tbl_za_Deposit_Start.Amount_Partial_Paying>0 then 0            
                         else tbl_za_Deposit_Start.Amount_Owed + tbl_za_Deposit_Start.New_Adjustment
                     end,      

                  Amount_Paying + tbl_za_Deposit_Start.P_Pay AS Tot

     FROM tbl_za_Deposit_Start
     WHERE tbl_za_Deposit_Start.Paying = 1  
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LJG
LJG

ASKER

Angel
As in the past you have the to the point answer.  You always make my life easier when you answer my questions.  I increased the points because it solved my problem exactly the way I wanted it solved.

Thanks Again
LJG