Present results below:
[tt]
ITEMNMBR QtyAlloc CMPTITNM BOMAlloc Grand_Tot_Pcs
<NULL> <NULL> 51130 48 <NULL>
<NULL> <NULL> 51480 72 <NULL>
10100 54 10100 72 126
65436 24 <NULL> <NULL> 24
72273 34 72273 20 54
[/tt]
Present code as below:
[tt]
SELECT TOP 100 PERCENT AIA.ITEMNMBR
, AIA.QtyAlloc
, CAWB.CMPTITNM
, SUM(CAWB.Total_Pcs_Needed) AS BOMAlloc
, ISNULL(SUM(CAWB.Total_Pcs_Needed), 0)
+ AIA.QtyAlloc AS Grand_Tot_Pcs
FROM dbo.[View_All_Items Allocated] AIA FULL OUTER JOIN
dbo.VIEW_CorrectAllocWithBOM CAWB ON AIA.ITEMNMBR = CAWB.CMPTITNM
GROUP BY AIA.ITEMNMBR
, AIA.QtyAlloc
, CAWB.CMPTITNM
ORDER BY AIA.ITEMNMBR
[/tt]
My desired results below:
[tt]
REFNM ITEMNMBR QtyAlloc CMPTITNM BOMAlloc Grand_Tot_Pcs
51130 <NULL> <NULL> 51130 48 48
51480 <NULL> <NULL> 51480 72 72
10100 10100 54 10100 72 126
65436 65436 24 <NULL> <NULL> 24
72273 72273 34 72273 20 54
[/tt]
Since I will use this view to feed many different cyrstal reports I want to try and avoid as much logic as possible when trying to pull the proper records from this view. Reason is because many of the reports that this view will feed this data is complicated enough as it is and do not want to have to add extra logic to the report just to pull the proper data from this VIEW. I will also need to pull the item number(REFNM) and grand total pieces (Grand_Tot_Pcs)
My fear is that since I am new to creating views it is so difficult for me to make changes to a present view and compare to past results to not only be sure that my new columns appear as needed but that my values have not changed. I basically have the logic but just don't have a strong enough SQL background yet.
Any help would be very much appreciated.
Thanks so much
Mark
Mark
Email: markanas333@hotmail.com
[tt]
ITEMNMBR QtyAlloc CMPTITNM BOMAlloc Grand_Tot_Pcs
<NULL> <NULL> 51130 48 <NULL>
<NULL> <NULL> 51480 72 <NULL>
10100 54 10100 72 126
65436 24 <NULL> <NULL> 24
72273 34 72273 20 54
[/tt]
Present code as below:
[tt]
SELECT TOP 100 PERCENT AIA.ITEMNMBR
, AIA.QtyAlloc
, CAWB.CMPTITNM
, SUM(CAWB.Total_Pcs_Needed) AS BOMAlloc
, ISNULL(SUM(CAWB.Total_Pcs_Needed), 0)
+ AIA.QtyAlloc AS Grand_Tot_Pcs
FROM dbo.[View_All_Items Allocated] AIA FULL OUTER JOIN
dbo.VIEW_CorrectAllocWithBOM CAWB ON AIA.ITEMNMBR = CAWB.CMPTITNM
GROUP BY AIA.ITEMNMBR
, AIA.QtyAlloc
, CAWB.CMPTITNM
ORDER BY AIA.ITEMNMBR
[/tt]
My desired results below:
[tt]
REFNM ITEMNMBR QtyAlloc CMPTITNM BOMAlloc Grand_Tot_Pcs
51130 <NULL> <NULL> 51130 48 48
51480 <NULL> <NULL> 51480 72 72
10100 10100 54 10100 72 126
65436 65436 24 <NULL> <NULL> 24
72273 72273 34 72273 20 54
[/tt]
Since I will use this view to feed many different cyrstal reports I want to try and avoid as much logic as possible when trying to pull the proper records from this view. Reason is because many of the reports that this view will feed this data is complicated enough as it is and do not want to have to add extra logic to the report just to pull the proper data from this VIEW. I will also need to pull the item number(REFNM) and grand total pieces (Grand_Tot_Pcs)
My fear is that since I am new to creating views it is so difficult for me to make changes to a present view and compare to past results to not only be sure that my new columns appear as needed but that my values have not changed. I basically have the logic but just don't have a strong enough SQL background yet.
Any help would be very much appreciated.
Thanks so much
Mark
Mark
Email: markanas333@hotmail.com