Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. CKG Edit ====== ====== ===== Explanation of SQL ===== This SQL generates a list of the taxable orders, taxable amounts, and tax rates from Sales in the GL from a particular timeframe. You will need to adjust the date range in both queries based on the range you are studying. The results will show you the effective tax rate for all taxable sales during that time period. ===== Risk of Data Corruption if Run Improperly ===== **None**. This is a selection query and no data is modified in the running of it. ===== SQL ===== <code sql> select orderID, sum(amount) SalesAmount from "GL Database" where DateTime between "4/1/2014" and "4/15/2014 23:59:59" and Taxable = 'T' and AccountCode between 4000 and 4999 group by orderID order by OrderID ; TaxableOrders select orderID, sum(amount) TaxAmount from "GL Database" where DateTime between "4/1/2014" and "4/15/2014 23:59:59" and AccountCode between 2501 and 2502 group by orderID order by OrderID ; Taxes select T.OrderID, Tor.SalesAmount, T.TaxAmount, cast(T.TaxAmount / tor.SalesAmount * 100 as float) as TaxRate from TaxableOrders Tor full outer join Taxes T on T.OrderID = Tor.OrderID order by TaxRate </code> ===== Version Information ===== * Entered : 5/2014 * Version : 8.6+