我的查询无效,如下所示:
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