Query 1 (I want all the results and only matching results from query 2)
They will be joined on PricingDrugGroupID and ForecastPeriodTimelineID eventhough query 2 does not return these columns it is in the table.
Query 1 code...
query 2
They will be joined on PricingDrugGroupID and ForecastPeriodTimelineID eventhough query 2 does not return these columns it is in the table.
Query 1 code...
Code:
SELECT dbo.PricingDrugGroup.PricingDrugGroupID,
dbo.PricingDrug.PricingDrugName,
dbo.PricingDrug.SequenceNumber As PricingDrugSequenceNumber,
dbo.Geography.GeographyName,
dbo.Geography.SequenceNumber,
dbo.PricingDrugGroupType.PricingDrugGroupTypeID,
dbo.PricingDrugGroupType.PricingDrugGroupTypeName,
dbo.ForecastPeriodTimeline.PeriodTimelineDate,
dbo.ForecastPeriodTimeline.ForecastPeriodTimelineID,
dbo.ForecastPeriod.PeriodTypeID
FROM dbo.ForecastPeriod
INNER JOIN dbo.ForecastPeriodTimeline ON dbo.ForecastPeriod.ForecastPeriodID = dbo.ForecastPeriodTimeline.ForecastPeriodID,
dbo.PricingDrugGroup
INNER JOIN dbo.PricingDrug ON dbo.PricingDrugGroup.PricingDrugID = dbo.PricingDrug.PricingDrugID
INNER JOIN dbo.VersionGeography ON dbo.PricingDrugGroup.VersionGeographyID = dbo.VersionGeography.VersionGeographyID
INNER JOIN dbo.Geography ON dbo.VersionGeography.GeographyID = dbo.Geography.GeographyID
INNER JOIN dbo.PricingDrugGroupType ON dbo.PricingDrugGroup.PricingDrugGroupTypeID = dbo.PricingDrugGroupType.PricingDrugGroupTypeID
WHERE dbo.PricingDrug.VersionID = 1395
AND dbo.ForecastPeriod.VersionID = 1395
AND dbo.PricingDrugGroup.BrandGeneric = 'Brand'
query 2
Code:
SELECT AdjustmentValue
FROM dbo.ForecastAdjustment