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 |
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-09-22 : 01:52:04
|
| HiWe have table data like....36 months data for each part_number..examplePArt_number month dataaaa 1 10aaa 2 20aaa 3 30 ... ... ...... ... ...... ... ... aaa 36 360bbb 1 10bbb 2 20bbb 3 30 ... ... ...... ... ...... ... ... bbb 36 360I need the query each part number first 12 month details....(like......Part_number, month_id, data)please help on this.........thanks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-22 : 02:00:52
|
selectPart_number,month_id,datafrom tablewhere month_id between 1 and 12order by Part_number,month_id No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-09-22 : 02:08:23
|
| thanks webfredi have one more doubt ...pls helpCREATE VIEW vIO_DF_Forecast_Data WITH SCHEMABINDINGASSELECT a.period , a.sku , a.period_id, model_id , (a.forecast_data+b.intelligence+b.adjustments)total_forecastFROM io_cm_forecast_data a, io_df_x_intelligence_forcaste bWHERE a.sku = b.sku AND a.period_id = b.period_idCREATE CLUSTERED INDEX idx_vIO_DF_ForecastON vIO_DF_Forecast_Data (sku, period_id)for above view i can't able to create index on that.... |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-09-22 : 02:18:45
|
| Thanks i have done alter VIEW dbo.vIO_DF_Forecast_Data WITH SCHEMABINDINGASSELECT a.period , a.sku , a.period_id, model_id , (a.forecast_data+b.intelligence+b.adjustments)total_forecastFROM dbo.io_cm_forecast_data a, dbo.io_df_x_intelligence_forcaste bWHERE a.sku = b.sku AND a.period_id = b.period_id AND a.period_id between 1 and 12--order by a.sku ,a.period_id CREATE UNIQUE CLUSTERED INDEX idx_vIO_DF_ForecastON vIO_DF_Forecast_Data (sku, period_id) |
 |
|
|
|
|
|
|
|