Here's a new challenge/problem I'm having.
I have two tables which need to link (somehow) in two ways...
1) (Dates) TableA.acct_month needs to be between TableB.flow_month and TableB.inv_month
2) (Locations) TableA.bp_name cannot equal TableB.bp_name
Essentially, I'm looking for the receipts that don't match up for a given month.
I've tried this... (but doesn't work at all)
SELECT [Receipt Commodity Charges].station_num, [Receipt Commodity Charges].station_name, [ProServ NOVA].acct_month
FROM [ProServ NOVA] INNER JOIN [Receipt Commodity Charges] ON ([ProServ NOVA].receipt_location <> [Receipt Commodity Charges].station_name) AND ( [Receipt Commodity Charges].inv_month > [ProServ NOVA].acct_month > [Receipt Commodity Charges].flow_month)
GROUP BY [Receipt Commodity Charges].station_num, [Receipt Commodity Charges].station_name, [ProServ NOVA].acct_month;
I was thinking about a "Union" or "Where" join, but don't know exactly how to create these properly...
(An Example of my failed "Where" join)
SELECT [Receipt Commodity Charges].station_num, [Receipt Commodity Charges].station_name, [Receipt Commodity Charges].flow_month, [Receipt Commodity Charges].inv_month
FROM [ProServ NOVA], [Receipt Commodity Charges]
WHERE (([ProServ NOVA].receipt_location<>[Receipt Commodity Charges].[station_name]) AND ([ProServ NOVA].acct_month BETWEEN [Receipt Commodity Charges].[flow_month] AND [Receipt Commodity Charges].inv_month))
GROUP BY [Receipt Commodity Charges].station_num, [Receipt Commodity Charges].station_name, [Receipt Commodity Charges].flow_month, [Receipt Commodity Charges].inv_month;
Any thoughts?