我正在寫一個類似於博客軟件的網絡應用程序。顯示所有條目標籤
並希望顯示由標籤分類的博客文章後,輸出到客戶端應該是:
--PostID 1--
--PostContent 1--
--Tags : tag1 , tag2 --
--PostID 2--
--PostContent 2--
--Tags : tag1 , tag2, tag3 --
--PostID 3--
--PostContent 3--
--Tags : tag3 , tag4--
所以我使用的查詢,如:
Select PostTitle, PostContent from tblBlogPost ...
但這些標籤位於在具有以下結構的新表格中:
PostID PostTag
1 tag1
1 tag2
2 tag1
2 tag2
2 tag3
3 tag3
3 tag4
所以我如何將標籤列表添加到我的查詢中?
可能重複的[如何變換從基於特定的列到另一個數據結構的行數據(http://stackoverflow.com/questions/19144535/how-to-transform-data-from-rows -based-on-a-specific-column-to-another-data-struc) –