How do you query in RMS database so that you can output monthly breakdown of Sales/Cost/Profit to Excel? I don't want to use Quickbooks for reports. It would look like: Jan Feb Mar Apr...
Didn't find your answer? Ask the community — no account required.
R
root
The following instructions are vague, but you will be able to figure it out.
create a new datasource pointing to your RMS database. start excel and create a new pivot table using external datasource. follow "wizard" customize query in MS Query. (view | SQL) use statement below for the SQL query, return data to MS Excel. (under file menu) customize table layout.
Just replace YOURDSN with your DSN (datasource name created in 1st step above.). You will have to customize the table layout to your specs.
SELECT CONVERT(datetime, CONVERT(nvarchar, [Transaction].Time, 101), 101) AS Time, Department.Name AS Department, Sum(transactionEntry.Quantity*TransactionEntry.Price) AS TotalRetail, Sum(TransactionEntry.Cost*TransactionEntry.Quantity) AS TotalCost FROM YOURDSN.dbo.[Transaction], YOURDSN.dbo.Department Department, YOURDSN.dbo.Item Item, YOURDSN.dbo.TransactionEntry TransactionEntry WHERE Item.DepartmentID = Department.ID AND TransactionEntry.ItemID Item.ID AND [Transaction].TransactionNumber = TransactionEntry.TransactionNumber GROUP BY [Transaction].Time, Department.Name
S
sammm
R
root
SQL queries will give you a basic datalist type of output. Although you can get complex with them, I really am not certain as to the full scope of their abilities. The reporting engines like Crystal/SQL Reporting Services do make it more comprehensive. I'm sure some of the more prolific coders/contributors to this group may be able answer that question more fully than I. Given the layout you used in your original post and refering to Excel, the first thing that came to mind was a pivot table.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.