I'm trying to convert this query into code igniter query. But i don't know where to start. I'm new to code igniter.Please help.
public function get_loginsecuritydetails($security_date,$apt_id) {
$sql = "SELECT s.* , IF( DATE( s.security_date ) = DATE( '$security_date' ) , 1, 0 ) AS loginstatus,a.agency_companyname FROM security s JOIN agency a ON(a.agency_id=s.security_cat) WHERE apartment_id='$apt_id'; ";
$res=mysqli_query($sql) or die(mysqli_error());
return $res;
}