I'm not sure if SQL is best to perform the task at hand or maybe a batch or Python script to run the SQL. Just looking for your thoughts and any ideas are much appreciated! Below is what I'm looking to do. Let me know if you need additional info to get me the best response!
We have an existing Database that is continuously being updated. What I need to do is run a Query, daily, and email the results to a particular email address. Each day I want the script to grab only the top 15 results. It would need to sort by Due Date. We have a column for Completed but it doesn't need to show in the report but I would imagine that I need it in the query so the results can be updated each day. Out of all the columns in the DB I only need to Query about 6 and display in the results all 6 besides the Completed column.
If possible, I'd like the email to include the results in HTML format rather than an attachment. My SQL is extremely rusty and I don't remember ever learning how to put into HTML. Below is what I have so far but the last line is not working. Thanks in advance for you help all!
SELECT [2015 E-Rate Projects].AD,
[2015 E-Rate Projects].ISR,
[2015 E-Rate Projects].[Potential Customer],
[2015 E-Rate Projects].[OppID],
[2015 E-Rate Projects].[Due Date]
FROM [2015 E-Rate Projects]
WHERE ((([2015 E-Rate Projects].[Response complete])="No"))
ORDER BY [2015 E-Rate Projects].[Due Date]
SELECT TOP 15;