-1
我正在为网站构建标记系统,并且在显示已标记的项目时遇到了问题。在mysql中结合不同的结果集(可能不能使用联合)
有3种不同类型的东西,一个可以在这个网站上的标签:
- 论坛主题
- 回复帖子任何这些线程
- 由用户创建的播放列表
左右当浏览某个标签时,用户应该能够看到所有这些不同的项目。这里的问题当然是所有三个项目都有不同的表格结构。而使用线程,还有额外的选择和连接到其他表的几个。所以显然选择的数据不会跨表匹配,这可能会遗漏MySQL的UNION语法(或者我认为)。
我有什么选择?
表模式:
threads: threadid, title, thread_type (article, event, artist, thread) events: eventid (corresponds to threadid on join), title, begin_time, end_time artists: artistid (corresponds to threadid on join), artist_username news: newsid, news_title, is_thread, threadid, postid (joined on either one; for threads, is_thread is used also) thread replies: postid, threadid, thread_title playlists: playlistid, playlist_title (is never associated with any previously mentioned tables)
一种选择是发布一些代码,例如,表格模式或您想要统一的单个查询。 –
查询是这里的问题,如果我知道我需要的,我不会寻求帮助。但感谢提醒我关于模式 – Valhallen