How to Write a query to get the output as shown below html table and there are some filter field too?.How to display the data that comes in the Inquiry descending order with Hot plus more?
I tried to write query:
function getEnquiries($filterData = '', $limit = 4, $start = 0, $date_filter = '') { $this->db->select('enq_id,year,varient_id,model_id,brand_id,' . $this->tbl_brand . '.brd_title,' . $this->tbl_variant . '.var_variant_name, ' . $this->tbl_model . '.mod_title,' . $this->tbl_enquiry . '.enq_id ') ->join($this->tbl_enquiry, $this->tbl_enquiry . '.enq_id = ' . $this->tbl_vehicle . '.veh_enq_id', 'LEFT') ->join($this->tbl_model, $this->tbl_model . '.mod_id = ' . $this->tbl_vehicle . '.veh_model', 'LEFT') ->join($this->tbl_brand, $this->tbl_brand . '.brd_id = ' . $this->tbl_vehicle . '.veh_brand', 'LEFT') ->join($this->tbl_variant, $this->tbl_variant . '.var_id = ' . $this->tbl_vehicle . '.veh_varient', 'LEFT'); $this->db->from($this->tbl_vehicle); $this->db->group_by(array($this->tbl_vehicle . '.year', $this->tbl_vehicle . '.varient_id')); if (isset($filterData['km']) && !empty($filterData['km'])) { $this->db->where_in($this->tbl_vehicle . '.veh_km_id', $filterData['km']); } if (isset($filterData['year']) && !empty($filterData['year'])) { $this->db->where_in($this->tbl_vehicle . '.veh_year', $filterData['year']); } if (isset($filterData['val_brand']) && !empty($filterData['val_brand'])) { $this->db->where_in($this->tbl_vehicle . '.veh_brand', $filterData['val_brand']); } if (isset($filterData['val_model']) && !empty($filterData['val_model'])) { $this->db->where_in($this->tbl_vehicle . '.veh_model', $filterData['val_model']); } if (isset($filterData['val_variant']) && !empty($filterData['val_variant'])) { $this->db->where_in($this->tbl_vehicle . '.veh_varient', $filterData['val_variant']); } $this->db->where($this->tbl_enquiry . '.enq_entry_date >=', $sale_date_from)->where($this->tbl_enquiry . '.enq_entry_date <=', $sale_date_to); // $this->db->limit($limit, $start); $this->db->limit($limit, $start); $query = $this->db->get(); $res = $query->result_array(); return $res; }
There are 5 tables . enquery_table ,vehcle_table,model_tb,variant_tb and brand_tb
gropup by year and varient_id |order_by("hotplus", "desc")
with pagination
Out put:
https://stackoverflow.com/questions/66746530/how-to-display-the-output-as-shown-below-html-table March 22, 2021 at 08:56PM
没有评论:
发表评论