Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allocate Period numbers where join not possible.

Status
Not open for further replies.

bhoran

MIS
Nov 10, 2003
272
US
I have a query that is attempting to do various calculations to later be use to append another table.

I want to allocate period numbers. The original records have a start_date and I have another table GLPERIODS that has start_date and End_date and period number.

If the start_date of the original record falls within the start_date and End_Date of the GLPeriods table I want to allocate that period number. I can't use a join (as far as I know).

Currently the query returns too many queries. I need help.

I have the following query:
SELECT IbmfcstUpload.Item, IbmfcstUpload.Descr, IbmfcstUpload.Brand, IbmfcstUpload.PGCode, IbmfcstUpload.PromoGroup, IbmfcstUpload.Packsize, IbmfcstUpload.State, Sum(IbmfcstUpload.Cases) AS SumOfCases, "IBM" AS LD, GLPERIODS.PERIOD_YEAR, GLPERIODS.PERIOD_NAME, GLPERIODS.PERIOD_NUM, IbmfcstUpload.Account, "GROCERY" AS Channel, Sum([IbmfcstUpload]![Cases]*[Pricing]![GROCERY]) AS AMT
FROM GLPERIODS, IbmfcstUpload INNER JOIN Pricing ON IbmfcstUpload.PGCode = Pricing.PGCODE
WHERE (((IbmfcstUpload.Account) Not Like &quot;Fal*&quot; And (IbmfcstUpload.Account) Not Like &quot;Frank*&quot; And (IbmfcstUpload.Account) Not Like &quot;David*&quot; And (IbmfcstUpload.Account)<>&quot;other-G&quot; And (IbmfcstUpload.Account) Not Like &quot;independen*&quot; And (IbmfcstUpload.Account) Not Like &quot;Impul*&quot; And (IbmfcstUpload.Account) Not Like &quot;Conv*&quot;) AND ((IbmfcstUpload.Start_Date) Between [GLPERIODS]![START_DATE] And [GLPERIODS]![END_DATE]))
GROUP BY IbmfcstUpload.Item, IbmfcstUpload.Descr, IbmfcstUpload.Brand, IbmfcstUpload.PGCode, IbmfcstUpload.PromoGroup, IbmfcstUpload.Packsize, IbmfcstUpload.State, &quot;IBM&quot;, GLPERIODS.PERIOD_YEAR, GLPERIODS.PERIOD_NAME, GLPERIODS.PERIOD_NUM, IbmfcstUpload.Account, &quot;GROCERY&quot;;

 
oops sorry disreagard - it was a data issue.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top