sql - How to use case statement properly? How to use case statement with where or join table? -


I am trying to change the display value for all passwords 1 = 1 with name 1 and password 2 = 1 2 values ​​in the database without the actual but when I executed the code, the system returned: 4145, level 15, state 1, line 22 expression specified non-boolean type expression where a condition was expected Is near the "command".

I have the output:


  • No

  • Ryan, Lisa, 1, 3214, 1, 2, 5, 4,

  • Leo, Ben, 3, 1, 1, WA

    The output should me

  • Name 1, Name 2, Gatecode, Password1, Password2, State


  • Ryan, Lisa, 1, 3214, 4564, Florida

  • Brendan, Joan, 2, 5324, Zone, NV
  • Leo, Ben, 3, Leo , Ben, Washington

    Here's my code:

      Top 10 as the 'name1' Please, select g.name1 as' name2 ',' c.gatecode 'as gatecode, c.pas1 as' password1', c.pas2 as' password2 ', as g.state' State 's guest from left code CG Where to enter Gest_cdoe = c.guest_code when password 1 = 1 and g.guest_cdoe = C.guest_code then ba.bank_name1 WHEN password 2 = 2 and g.guest_cdoe = c.guest_code then ba.bank_name1 3 end order  

    I think this is what you want ... it's hard to say but you Must say in the right direction. You want in the selection statement in the case, where the statement is not.

      Top 10 G Name 1 is named '1', g. In the form of name2, select 'name2', c.gateCode as gatecode when the case is C.pas1 = 1 and g.guest_cdoe = c.guest_code then g.name1 ELSE c.pas1 END, in case when c.pas2 = 1 and g.guest_cdoe = c.guest_code then g.name2 ELSE c.pas2 END, g. As a state, guest 'ji wa' code from C.G.Guide CDDO = C. Gwastcode sequence 3 to    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -