http://www.perlmonks.org?node_id=1206605


in reply to Re^2: DBIx::Class Build a Where Clause with multiple ORs and ANDs
in thread DBIx::Class Build a Where Clause with multiple ORs and ANDs

I do not want send_email to be undefined or have a value of '0000-00-00', when status is equal to Offered, Denied, Cancelled, or Conditional Offer.

However, if the status equals Review, the sent_email can have any value.

But in your initial example in your OP you said:

The where clause should be:
WHERE status='Review' OR ( ( status='Offered' OR status='Denied' OR status='Cancelled' OR status='Conditional Offer') AND ( sent_email is NULL OR sent_email='0000-00-00') )

I showed you how to achieve the outcome described in your most recent comment in an earlier thread. I've updated my response to your initial query today now that you've clarified your spec.


The way forward always starts with a minimal test.