0

I am getting error in this query,

SELECT count(if(state=0)) FROM `nagios`.`nagios_hostchecks`
where `nagios_hostchecks`.`start_time` like '%2012-01-02%'
and `nagios_hostchecks`.`host_object_id`=60;
1
  • 1
    Mind posting the error you received? Commented Jan 2, 2012 at 5:34

2 Answers 2

3

How about this:

SELECT count(*) 
FROM `nagios`.`nagios_hostchecks` 
WHERE `nagios_hostchecks`.`start_time` like '%2012-01-02%' 
    AND 
`nagios_hostchecks`.`host_object_id`=60
    AND
`state` = 0;
Sign up to request clarification or add additional context in comments.

Comments

3

Just a quick guess without checking nagios schema

SELECT count(*) FROM nagios.nagios_hostchecks
WHERE state=0 AND nagios_hostchecks.start_time like '%2012-01-02%' 
AND nagios_hostchecks.host_object_id=60;

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.