$this->db->query("
SELECT *
FROM posts
LEFT JOIN sub_category
on sub_category.sub_id = posts.category_post_id
LEFT JOIN categories
ON categories.cat_id = sub_category.parent_id
LEFT JOIN images
ON images.img_post_id = post.ID
WHERE sub_category.sub_id=" . $sub_id . "
AND posts.title LIKE %" . $keyword . "%
concat(price,' ', curency) as price,
curency,
case
when curency= 'EUR'
then concat(price,' ',curency)
when curency= 'USD'
then concat(price,' ',curency) * 0.73
end as in_euros
ORDER BY CAST(in_euros as DECIMAL) " . $start_from . "
LIMIT" . $num . "," . $start
)
->result_array();
return $query;
Может ли кто-нибудь объяснить мне, как использовать concat в таком случае.
[code]$this->db->query(" SELECT * FROM posts LEFT JOIN sub_category on sub_category.sub_id = posts.category_post_id LEFT JOIN categories ON categories.cat_id = sub_category.parent_id LEFT JOIN images ON images.img_post_id = post.ID WHERE sub_category.sub_id=" . $sub_id . " AND posts.title LIKE %" . $keyword . "% concat(price,' ', curency) as price, curency, case when curency= 'EUR' then concat(price,' ',curency) when curency= 'USD' then concat(price,' ',curency) * 0.73 end as in_euros ORDER BY CAST(in_euros as DECIMAL) " . $start_from . " LIMIT" . $num . "," . $start ) ->result_array(); return $query; [/code] Может ли кто-нибудь объяснить мне, как использовать concat в таком случае.