|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I have two table
Table 1 Forecast Fields Accounting 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 master Forecast Amount Table 2 Invoice Fields Accounting 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 master Invoice Amount There are other fields also in those tables but will not concern the present Purpose My 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 SumOfAmount SELECT [invoice].[Sub Code], [invoice].[Vendor Name], [invoice].[Resource Name], [invoice].[Accounting Period] FROM invoice GROUP 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 |
|
#2
|
|||
|
|||
|
pls help
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > MS SQL Query Help needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|