Link to home
Start Free TrialLog in
Avatar of Amanda Walshaw
Amanda WalshawFlag for Australia

asked on

sql 2008 view

I have created the following view
create      view [dbo].[myview_vw]
AS
SELECT            a.vendor_code,
            a.address_name,
            a.contact_phone,
            a.fax_number,
            a.attention_email,
            a.terms_code,
            b.bank_name,
            b.bank_account_num,
            b.aba_number,
            b.account_type
                   
FROM        mymaserap a,  mybankdet b
where         a .vendor_code = b.vendor_code

GO

this works fine but what I want to say is what is a Savings Account and what is A cheque account based on b. account_type

alter     view [dbo].[myview_vw]
AS
SELECT            a.vendor_code,
            a.address_name,
            a.contact_phone,
            a.fax_number,
            a.attention_email,
            a.terms_code,
            b.bank_name,
            b.bank_account_num,
            b.aba_number,
            b.account_type = case b.account_type
                                         when 0 then 'Savings Account'
                                         when 1 then 'Cheque Account'
                            end      
FROM        mymaserap a,  mybankdet b
where         a .vendor_code = b.vendor_code

GO

I am getting syntax error near '='
I should be able to put in a case here.
Would welcome some advice
SOLUTION
Avatar of Eyal
Eyal
Flag of Israel 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
SOLUTION
Avatar of santhimurthyd
santhimurthyd
Flag of United States of America 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
ASKER CERTIFIED SOLUTION
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 Amanda Walshaw

ASKER

tempdba gave me the best explanation