title: Convert query in codeigniter
body: <p>Im working on ecommerce platform. I have a query in normal form. i want to convert to codeigniter.</p>
  
  <p>this is my query</p>
  
  <pre><code>SELECT products.product_name,products.product_id,products.short_description,pi.img,
  CASE WHEN products.sp_price=0 THEN products.price WHEN products.sp_price!=0 THEN products.sp_price END as pprice FROM 
  (`offers_products`) JOIN `products` ON `offers_products`.`product_id` = `products`.`product_id`  
  LEFT JOIN (SELECT image_name as img,product_id as pid from product_images GROUP BY pid)pi 
  ON `products`.`product_id` = `pi`.`pid` .
  </code></pre>
  
  <p>How do i convert this to codeigniter query.</p>
  
  <p>I tried, but getting syntax error. Please help me, im new to codeigniter.</p>