My SQL Query is going into a Excel Data Base. The information is coming from 3 retail stores. Occasionally one of the POS systems will go down and we need to enter information in manually. This is where the problem starts. When I have made error corrections manually in the excel database it gets over written. If I make a month end adjustment to sales using the last day of the month, which already has a sales day it now starts to double the days in the data base. Any suggestions.
SELECT DISTINCTROW Year([sbdate]) AS [Year], IIf([month]>=10,[month]-9,[month]+3) AS [Fiscal Month], Month([sbdate]) AS [Month], DBA_SysBal.storenum, DBA_SysBal.sbdate, DBA_SysBal.netsales, DBA_SysBal.overshort, DBA_SysBal.avgticketcust, DBA_SysBal.disccount, DBA_SysBal.totaldiscounts, DBA_SysBal.custcount, DBA_SysBal.transvoidttl, DBA_SysBal.refundcount, DBA_SysBal.refundttl, DBA_SyB_Spec.spfldcount, DBA_SyB_Spec_1.spfldcount, DBA_SyB_Spec_2.spfldcount, IIf([cash donations for excel.cash donations] Is Null,0,[cash donations for excel.cash donations]) AS [Cash Donations]
FROM (((DBA_SysBal LEFT JOIN DBA_SyB_Spec ON DBA_SysBal.id = DBA_SyB_Spec.headerid) LEFT JOIN DBA_SyB_Spec AS DBA_SyB_Spec_1 ON DBA_SysBal.id = DBA_SyB_Spec_1.headerid) LEFT JOIN DBA_SyB_Spec AS DBA_SyB_Spec_2 ON DBA_SysBal.id = DBA_SyB_Spec_2.headerid) LEFT JOIN [Cash Donations for Excel] ON (DBA_SysBal.storenum = [Cash Donations for Excel].storenum) AND (DBA_SysBal.sbdate = [Cash Donations for Excel].rcpdate)
WHERE (((DBA_SyB_Spec.spfldnumber)=2) AND ((DBA_SyB_Spec_1.spfldnumber)=3) AND ((DBA_SyB_Spec_2.spfldnumber)=4))
ORDER BY DBA_SysBal.sbdate;
SELECT DISTINCTROW Year([sbdate]) AS [Year], IIf([month]>=10,[month]-9,[month]+3) AS [Fiscal Month], Month([sbdate]) AS [Month], DBA_SysBal.storenum, DBA_SysBal.sbdate, DBA_SysBal.netsales, DBA_SysBal.overshort, DBA_SysBal.avgticketcust, DBA_SysBal.disccount, DBA_SysBal.totaldiscounts, DBA_SysBal.custcount, DBA_SysBal.transvoidttl, DBA_SysBal.refundcount, DBA_SysBal.refundttl, DBA_SyB_Spec.spfldcount, DBA_SyB_Spec_1.spfldcount, DBA_SyB_Spec_2.spfldcount, IIf([cash donations for excel.cash donations] Is Null,0,[cash donations for excel.cash donations]) AS [Cash Donations]
FROM (((DBA_SysBal LEFT JOIN DBA_SyB_Spec ON DBA_SysBal.id = DBA_SyB_Spec.headerid) LEFT JOIN DBA_SyB_Spec AS DBA_SyB_Spec_1 ON DBA_SysBal.id = DBA_SyB_Spec_1.headerid) LEFT JOIN DBA_SyB_Spec AS DBA_SyB_Spec_2 ON DBA_SysBal.id = DBA_SyB_Spec_2.headerid) LEFT JOIN [Cash Donations for Excel] ON (DBA_SysBal.storenum = [Cash Donations for Excel].storenum) AND (DBA_SysBal.sbdate = [Cash Donations for Excel].rcpdate)
WHERE (((DBA_SyB_Spec.spfldnumber)=2) AND ((DBA_SyB_Spec_1.spfldnumber)=3) AND ((DBA_SyB_Spec_2.spfldnumber)=4))
ORDER BY DBA_SysBal.sbdate;