$sql = "SELECT * FROM tb_opportunity WHERE date BETWEEN '2013-01-01' AND '2013-01-31' "; //Query code..
$sql = "SELECT * FROM tb_opportunity "; $sql .= "INNER JOIN tb_payment ON tb_payment.opp_id = tb_payment .opp_id_ref"; $sql .= "WHERE tb_opportunity.date BETWEEN '2013-01-01' AND '2013-01-31' "; //Query code..
$sql = "SELECT * FROM tb_opportunity "; $sql .= "INNER JOIN tb_payment ON tb_payment.opp_id = tb_payment .opp_id_ref"; $sql .= "WHERE tb_opportunity.date BETWEEN '2013-01-01' AND '2013-01-31' "; $sql .= "AND tb_payment.pay_date BETWEEN '2013-01-01' AND '2013-01-31' "; //Query code..