Welcome Guest, Not a member yet? Register   Sign In
Gets too much data
#3

(This post was last modified: 04-24-2015, 01:33 PM by Toddles.)

(04-24-2015, 01:13 PM)CroNiX Wrote: I think you'd want to use parens around the (and or) so it will use one OR the other, but not both:
SELECT* FROM ( `morning_qa` )
WHERE`qa_date`>='2014-04-24'
AND`qa_date`<='2015-04-24'
AND (`qa_type`='iris' OR `qa_type`='cones')
ORDERBY`qa_date`;

PHP Code:
if ($qa_type == "iris"){
            
$this->db->where('qa_type'$qa_type);
        }
        if (
$qa_type == "cones"){
            
$this->db->where('qa_type'$qa_type);
        }
        if (
$qa_type == "both"){
            
$this->db->where('qa_type'"iris");
            
$this->db->or_where('qa_type'"cones");
        } 


How do you add the parens.
Reply


Messages In This Thread
Gets too much data - by Toddles - 04-24-2015, 01:03 PM
RE: Gets too much data - by CroNiX - 04-24-2015, 01:13 PM
RE: Gets too much data - by Toddles - 04-24-2015, 01:18 PM
RE: Gets too much data - by CroNiX - 04-24-2015, 01:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB