0

I created a module for rendering overtime. In the module you will select your approving person and it will be maximum of 3 persons.

The scenario is that I will display all approved overtimes if manager1_date is not NULL, manager2_date is not NULL and manager3_date is not NULL. But as i said, it can be only 1,2 or 3 approving person. what if i applied then i have only 2 approving persons, it should be if manager1_date is not NULL and manager2_date is not NULL.

I tried this query:

Select * from table1 
where manager1_date is not null 
AND (manager2_date is not null or manager3_date is not null)

In PHP, it displays the record but the record has 3rd approving person which is manager3_date is NULL. it should not display the record until the approving persons are filled out.

5
  • So just append that AND to your query? Commented Nov 8, 2013 at 3:13
  • Could I ask what is the difference? What do you mean by //no selection? Commented Nov 8, 2013 at 3:13
  • i edited it now.. sorry for confusion. Commented Nov 8, 2013 at 3:21
  • Is there a reason you're SHOUTING your question here? Apparently your CAPS lock is not stuck. Do you think typing your question IN ALL CAPS will get you an answer more quickly? (The answer to that is no, BTW.) Commented Nov 8, 2013 at 3:23
  • Did the answers below help you out? Commented Nov 8, 2013 at 15:11

2 Answers 2

1

I think you are saying that all three managers must approve. If so your query would be:

SELECT *
FROM table1 
WHERE manager1_date IS NOT null 
AND manager2_date IS NOT null 
AND manager3_date IS NOT null
Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure if I understand your question, but if you need to see when all three manager dates are not null, get rid of the "or".

Select * 
from   table1 
where  manager1_date is not null 
       AND manager2_date is not null 
       AND manager3_date is not null

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.