ALTER PROCEDURE dbo.getRecords ( @GetFound int = 1 ) AS /* declare @rec table( invoiceNumber nvarchar(40), debtor nvarchar(80), accountNumber nvarchar(40), paidToUs numeric(18,2), GST numeric(10,2),ourDate nvarchar(10)) insert into @rec SELECT DISTINCT OurRecords.invoiceNumber, OurRecords.debtor, OurRecords.AccountNumber, SUM(OurRecords.paidToUs), SUM(OurRecords.GST), ourDate From OurRecords GROUP BY invoiceNumber, debtor, AccountNumber, OurDate */ if @getFound=1 BEGIN SELECT DISTINCT OurRecords.fileName, OurRecords.invoiceNumber, OurRecords.debtor, OurRecords.AccountNumber, OurRecords.paidToUs, OurRecords.dueToUs, OurRecords.GST, OurRecords.ourDate, ExcelData.DateAgency, ExcelData.DateDirect FROM ExcelData INNER JOIN OurRecords ON ExcelData.Account = OurRecords.AccountNumber AND ExcelData.Amount1 = OurRecords.paidToUs AND ExcelData.Amount3 = OurRecords.dueToUs And ExcelData.DateAgency<=OurRecords.ourDate ANd ExcelData.DateDirect>=OurRecords.ourDate END ELSE BEGIN SELECT DISTINCT Debtor, Account, Amount1 AS PaidToUs, Amount3 AS DueToUs, Amount4 AS GST, DateAgency, DateDirect FROM ExcelData WHERE (id NOT IN (SELECT DISTINCT XD.id FROM ExcelData AS XD INNER JOIN OurRecords AS OD ON XD.Account = OD.AccountNumber AND XD.Amount1 = OD.paidToUs AND XD.Amount3 = OD.dueToUs AND (XD.DateAgency<=OD.OurDate AND XD.DateDirect>=OD.OurDate))) END
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE