Sunday 15 May 2011

database - Codeigniter SQL Query Like in a group by field -



database - Codeigniter SQL Query Like in a group by field -

i have codeigniter code produces query:

select other_categories.id main_id, other_categories.name main_full_name, category_type policy_no, group_concat(concat_ws(" ", other_cat_details.first_name, other_cat_details.middle_name, other_cat_details.last_name)) other_full_name (`other_categories`) left bring together `other_category_details` on `other_category_details`.`other_category_id` = `other_categories`.`id` left bring together `users` other_cat_details on `other_cat_details`.`id` = `other_category_details`.`user_id` `category_type` = '2' grouping `main_id` order `name` asc limit 10

is there way can add together query can query filter info other_full_name variable $name_entered?

adding before grouping by:

$this->db->like('other_full_name', $name);

produces: unknown column 'other_full_name' in 'where clause'

please note wildcard search result series of characters query suggests. having clause recognize other_full_name. i'm wondering if can add together 'like' it.

any help highly appreciated. please inquire clarification.

you can utilize having clause:

having(other_full_name = $name)

in codeigniter, think be:

$this->db->having('other_full_name $name')

or similar variant

sql database codeigniter

No comments:

Post a Comment