dqdz6464 2016-06-22 13:01
浏览 34
已采纳

将SQL转换为Codeigniter查询[关闭]

I've got SQL from my last unswer here, but can't transform this to CodeIgniter Query, get an some errors, does anybody can help me with this? huge thanks!

select topic_tags.slug_tag, t1.post_id, t1.post_url, t1.post_subject
from topic_tags 
inner join user_topics on topic_tags.id_topic = user_topics.topic_id
left join
select max(topic_tags.slug_tag) as unique_slug_tag, posts.post_id, posts.post_url, posts.post_subject
from topic_tags 
inner join user_topics on topic_tags.id_topic = user_topics.topic_id
inner join tags on tags.tag_slug = topic_tags.slug_tag
inner join posts_tags on tags.id_tag = posts_tags.tagid
inner join posts posts_tags.postid = posts.post_id AND posts_tags.creator_id =$u
where topic_tags.id_topic = $i
group by posts.post_id, posts.post_url, posts.post_subject) t1 on topic_tags.slug_tag = t1.unique_slug_tag
where topic_tags.id_topic = $i
  • 写回答

1条回答 默认 最新

  • douqianrou9079 2016-06-22 13:08
    关注

    Use simple query format.

    $this->db->query('YOUR QUERY HERE');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里