这是concat的正确用法吗?

时间:2013-12-21 18:49:52

标签: mysql codeigniter concat

$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。

感谢。

0 个答案:

没有答案