我有一個動態生成的查詢。查詢連接差異
SELECT '' + CAST(GalleryGallery_tGallery._Name AS VARCHAR(4000)) + '' AS NewName
FROM Photographers_tGalleries
LEFT OUTER JOIN Gallery_tGallery AS GalleryGallery_tGallery
ON BaseContent_tGalleries.[Gallery] = GalleryGallery_tGallery._Guid
LEFT OUTER JOIN BaseContent_tGalleries
ON Photographers_tGalleries._Guid =
BaseContent_tGalleries._Guid_Structure_Content
這些連接對我來說似乎是正確的。但是,查詢錯誤與The multi-part identifier "BaseContent_tGalleries.Gallery" could not be bound.
以下查詢不起作用。雖然連接匹配正確的字段,但它們的順序不同。我想知道爲什麼這個工作,其他不工作。我們希望修復最大的一個,但由於它是動態的,我正在尋找最少的變化。
SELECT '' + CAST(GalleryGallery_tGallery._Name AS VARCHAR(4000)) + '' AS NewName
FROM Gallery_tGallery AS GalleryGallery_tGallery
LEFT OUTER JOIN BaseContent_tGalleries
ON GalleryGallery_tGallery._Guid = BaseContent_tGalleries.Gallery
LEFT OUTER JOIN Photographers_tGalleries
ON BaseContent_tGalleries._Guid_Structure_Content =
Photographers_tGalleries._Guid
我知道這是瘋狂的,這些都是dailywtf類型的東西。我決定重寫整個功能。謝謝你的幫助 –