开发者

problem in running complex multiple table mysql query

开发者 https://www.devze.com 2023-01-01 10:41 出处:网络
i need to sh开发者_运维问答ow pages\'details , now i used this query to fetch from 3 tables group_concat( )

i need to sh开发者_运维问答ow pages'details , now i used this query to fetch from 3 tables

group_concat( )

its working fine but shows array of tags and topics duplicated.


You're getting extra rows from the join. Add DISTINCT to the GROUP_CONCAT construct:

SELECT  table_stories.*,
  table_stories.sid,table_tags.tid,table_topics.topicid,
  group_concat(DISTINCT table_tags.tag ) as mytags,
  group_concat(DISTINCT table_topics.topicname ) as mytopics
FROM table_stories,table_tags,table_topics
0

精彩评论

暂无评论...
验证码 换一张
取 消