tags:

views:

39

answers:

1

hey guys

i need to show 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.

+4  A: 

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
ircmaxell
wow how smart ! thanks man your answer did the trick
Mac Taylor