Today's blog is about using SQL commands directly in Excel. I am going after data in Sage ACT, but you can use the same technique to go after a wide variety of data sources that are SQL based.
On the next screen you can now paste in a SQL string. Here's the one I am using today:
Select dbo.CONTACT.PHONE,dbo.contact.state,O.COMPANY, O.OPPORTUNITY_NAME, PRODUCT_SERVICE.NAME, PRODUCT.PRODUCT, CAST(O.CREATE_DATE AS CHAR(11)) AS 'Create Date', CAST(O.TOTAL AS DECIMAL(18,2)) AS 'Total', O.STATUSnum, O.Record_ManagerFrom dbo.OPPORTUNITY O LEFT Join dbo.OPPORTUNITY_PRODUCTSERVICE On O.OPPORTUNITYID = dbo.OPPORTUNITY_PRODUCTSERVICE.OPPORTUNITYID LEFT Join dbo.PRODUCT_SERVICE On dbo.PRODUCT_SERVICE.PRODUCTSERVICEID = dbo.OPPORTUNITY_PRODUCTSERVICE.PRODUCTSERVICEID LEFT Join dbo.PRODUCT On dbo.PRODUCT_SERVICE.PRODUCTID = dbo.PRODUCT.PRODUCTID LEFT Join dbo.CONTACT_OPPORTUNITY On dbo.CONTACT_OPPORTUNITY.OPPORTUNITYID = O.OPPORTUNITYID LEFT Join dbo.CONTACT On dbo.CONTACT.CONTACTID = dbo.CONTACT_OPPORTUNITY.CONTACTID Where O.Statusnum = 0ORDER BY O.Company, O.OPPORTUNITY_NAME
As you can see, it's quite complex and joins together multiple tables. Ah, but it produces a nifty report. Here's what it looks like in Excel.
In our example today, I am going after ACT data, but it works on all kinds of CRM applications or any tables that are SQL based. Have fun creating some cool reports.