Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rajeshhariharan
Starting Member
2 Posts |
Posted - 2004-02-27 : 18:33:59
|
| have two tableTable 1 ForecastFieldsAccounting Period (pull up from another table Accounting period Master)Vendor Name (Pull up from vendor Master table)Resource Name (Pull up from Resource master table)Sub Code (Pull up from Sub code masterForecast AmountTable 2 InvoiceFieldsAccounting Period (pull up from another table Accounting period Master)Vendor Name (Pull up from vendor Master table)Resource Name (Pull up from Resource master table)Sub Code (Pull up from Sub code masterInvoice AmountThere are other fields also in those tables but will not concern the present PurposeMy objective is to get a query that throws up the Forecas & Actuals data in columnar fashion by accouting period. That is Column 1 Accoting period 1 Forecast, Column 2 accouting period 1 actuals, Column 3 Accting period 2 Forecats, Column 4 Accounting period 2 Actausl and so on. Grouped by sub code, vandor and resource name.This list i need for all resources who are either forecasted for or for whom there are actuals.The current query i have written is:TRANSFORM Sum([Invoice].[Amount]) AS SumOfAmountSELECT [invoice].[Sub Code], [invoice].[Vendor Name], [invoice].[Resource Name], [invoice].[Accounting Period]FROM invoiceGROUP BY [invoice].[Sub Code], [invoice].[Vendor Name], [invoice].[Resource Name], [invoice].[Accounting Period], [invoice].[Sub Code], [invoice].[Resource Name]ORDER BY [invoice].[Accounting Period], [invoice].[Vendor Name]PIVOT [invoice].[Accounting Period];This outputs the actuals data the way I want it. Now I need to get the forecast data in columnar form within this query. I have treid some option but have been unsuccessful. Pls help |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-02-27 : 18:36:12
|
| You posted the same question in two forums (which isn't necessary BTW), one of them being the Access forum. So is this a SQL Server question or an Access question?Tara |
 |
|
|
|
|
|
|
|