mercredi 22 novembre 2017

how to case and if become sql command

I have a code. I want to this code become sql command. My table column have 'Holiday','IsRestDay','mNP1','mNP2','mNP3','mNP4','mNP5'

How to do it?

   Case Holiday='S'
        If IsRestDay
            mNP4_F8=mNP4_F8+Night_F8    
        Else
            mNP2_F8=mNP2_F8+Night_F8    
        Endif
    Case Holiday='L'
        IF IsRestDay
            mNP5_F8=mNP5_F8+Night_F8    
        Else
            mNP3_F8=mNP3_F8+Night_F8    
        Endif
    Other
        If IsRestDay
            mNP2_F8=mNP2_F8+Night_F8    
        Else
            mNP1_F8=mNP1_F8+Night_F8    
        Endif

I try to use case when ,but

Aucun commentaire:

Enregistrer un commentaire