0
我在下面如下表:SQL Server查詢:連接查詢
Monster:
Name Description EatsPeople
Vampire Pale, afraid of light True
Ghost See-through, annoying False
Wraith Green-ish, ugly, dumb True
TagLookup:
Name ID
Ghost 1
Ghost 2
Wraith 1
Tags:
ID Text Value
1 Green green-skin
2 Screams like a banshee banshee-call
要應用了「綠皮」標籤返回任何怪物,我這樣做:
SELECT m.Name, m.Description, m.EatsPeople
FROM dbo.Monster AS m
INNER JOIN dbo.TagLookup AS tl
ON m.Name = tl.Name
INNER JOIN dbo.Tags AS t
ON t.ID = tl.ID
AND t.Value = 'green-skin';
但如何我是否也會將標籤表的文本字段與怪物信息一起返回?
您是否嘗試過在'SELECT'聲明加入't.Text'? – Bernard 2012-02-26 04:41:31