-5
我查詢不工作是如下:我的查詢不按預期工作
CREATE TABLE #tempCal (
CategoryId BIGINT
,CategoryName NVARCHAR(max)
,ElementWeight MONEY
,MakingCharges MONEY
,GemstoneAttribute NVARCHAR(max)
,AlloyAttribute NVARCHAR(max)
,Rates MONEY
)
--insert into #tempCal(CategoryId,CategoryName,ElementWeight,MakingCharges,GemstoneAttribute,AlloyAttribute,Rates)
--values
DECLARE @iterator BIGINT = (
SELECT max(MstJewelleryProduct.ID)
FROM MstJewelleryProduct
)
INSERT INTO #tempCal (
CategoryId
,CategoryName
,ElementWeight
,MakingCharges
,GemstoneAttribute
,AlloyAttribute
,Rates
)
VALUES (
(
SELECT MstJewelleryProduct.ElementWeight
,MstJewelleryProduct.Element_Price
,MstJewelleryProduct.MakingCharges
,MstJewelleryProduct.GemstoneAttribute
,MstJewelleryProduct.AlloyAttribute
,MstJewelleryCategory.ID
,MstJewelleryCategory.CategoryName
,MstRates.Rates
,MstJewelleryOffers.OfferAmount
FROM MstJewelleryProduct
INNER JOIN MstJewelleryCategory ON MstJewelleryProduct.CategoryID = MstJewelleryCategory.ID
LEFT JOIN MstRates ON MstJewelleryProduct.CategoryID = MstRates.CategoryId
LEFT JOIN MstJewelleryOffers ON MstJewelleryProduct.CategoryID = MstJewelleryOffers.ProductCategory
AND MstJewelleryOffers.IsActive = 1
WHERE MstJewelleryProduct.IsActive = 1
)
)
SELECT *
FROM #tempCal
DROP TABLE #tempCal
你可以請說什麼不工作? – JFPicard
你得到了什麼輸出?或錯誤? –
如果沒有可回答的問題,您可能需要先嚐試將子查詢中返回的值與臨時表中定義的列對齊。 –