Relation From News, Posts Table To Tag Table

Hi everybody,

I’ve create some tables like that



Now when I connect to a link like: I want to get all posts & news have tag with slug some-thing via table tag_datas and order by posteddate.

With one table posts or news, It’s very easy with relation. Any solutions for me?



I suggest to use single table inheritance for posts and news table. Look at this link. Why do you have column "slug" in posts/news and also in tags? You have join table "tag_datas", so you can use it to get all posts for given slug.

Thanks for your support! But slug is special link for each news, posts or tags (because i use vietnamese).

At last i could be resolve by union query!