SQL: How do you return a record in a conditional statement and return a null value if false? -


I am trying to return the records of people living in Baton Rouge, Connecticut. If any person is also an employee, then his work center ID is also displayed. Otherwise, a zero value is returned. I am using the staff of staff and the person I am stuck, what is the case statement is where I am trying to return the workstation ID if any person employee (if he has an employee ID), otherwise, a vacuum Value should print. SELECT last_name, first_name, birth_date, city, state, employee_id, work_center_id, (case when employee_id = 'no, not so' work_center_id ELSE employee_id = 'NULL', END) , Employee where the city like UPPER ('Bethany') and state = 'Connecticut' order by employee_id ASC;

I'm not sure how it can reach a record, if it satisfies the condition or when the situation is not in existence, then can print zero value. I have seen the Oracle i-learning slides and the slides of my teacher and how I did not know how I am using Oracle SQL.

try it

  SELECT last_name, first_name, birth_date, city, State, employee_id, work_center_id, case when employee_id is not working, then work_central_id as ELSE faucet end, where the employee is from upper ('Bethany') and state = 'Connecticut' employee AISC;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -