1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SQL] want to execute first condition and then a second condition for the same parameter field

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 10, 2021.

  1. Stack

    Stack Membro Participativo

    want to execute first condition and then a second condition for the same parameter field.

    for example:

    Select
    A
    B
    C
    From XYZ
    Where A = case @p1 when 'All' then A else @p1 end;
    A = case when @p2 when 'Current' then @p1 else 'old'+ p@1


    What I'm trying to do is get the value from the first parameter. Either it is one value or all of the values in that column. So, if I select 'All', all of the values in that column will be used for the second condition where if I select 'Current' as a value. It will keep the select value/values else it will add the word 'old' in front of the value.

    I hope I make sense as I am really a beginner.

    Any help is appreciated.

    Continue reading...

Compartilhe esta Página