I've got a table that is set up similar to the following: personID|Last_Name|First_Name|feeDescription|feebalance|client1_email|client2_email
1|Test|Joe|2017 Fees|90.00|joe@test.com|joe2@test.com
1|Test|Joe|2017 Parking|40.00|joe@test.com|joe2@test.com
2|Sample|Nellie|2018 Membership|120.00|whoanellie@test.com|Null
What I would like to do is create a sql job that runs once a week and emails users with balance. I'd like to include a sent mail column so they only get the email once but would get a new email if a new fee was added. It would sent to client1_email if not null and cc to client2_email if not null.
The body would look similar to:
Dear Joe Test:
You have the following outstanding account fees with us:
2017 Fees $90.00
2017 Parking $40.00
And proceed to process the rest of the table:
Dear Nellie Sample:
You have the following outstanding account fees with us:
2018 Membership $120.00
Some personID's may have 1 fee, some 10. Is there a way to accomplish this?