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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 day wise query

Author  Topic 

raghu_grdr
Starting Member

17 Posts

Posted - 2014-11-17 : 05:25:09
Part Machine Qty Start Date End Date
Part 1 Machine 1 4650 11/03/2014 06:55:00 11/05/2014 12:55:00
Part2 Machine 1 5600 11/05/2014 14:00:00 11/07/2014 06:00:00
Part 3 Machine 1 2975 11/07/2014 06:00:00 11/09/2014 06:00:00
Part 4 Machine 1 2750 11/03/2014 06:05:00 11/05/2014 06:00:00
Part 5 Machine 1 1000 11/05/2014 06:00:00 11/06/2014 06:00:00
Part 6 Machine 1 1300 11/06/2014 06:00:00 11/07/2014 06:00:00
Part 7 Machine 1 1350 11/09/2014 06:00:00 11/10/2014 06:00:00
Part 8 Machine2 1625 11/03/2014 06:00:00 11/05/2014 06:00:00
Part 9 Machine2 4125 11/05/2014 06:00:00 11/09/2014 06:00:00
Part 10 Machine2 800 11/09/2014 06:00:00 11/10/2014 06:00:00
Part 11 Machine3 4950 11/03/2014 06:00:00 11/04/2014 14:20:00
Part 12 Machine3 500 11/04/2014 14:20:00 11/05/2014 14:20:00
Part 13 Machine3 6650 11/05/2014 15:00:00 11/07/2014 06:00:00
Part 14 Machine3 300 11/07/2014 06:30:00 11/08/2014 06:00:00
Part 15 Machine3 7650 11/08/2014 06:30:00 11/10/2014 06:00:00

I want dispaly the query as

MACHINE DATE
3 4 5 6 7 8 9
Machine 1 Part A Part A / Part B Part B Part C NO PLAN

TOTAL SHOTS PLAN 1600 3300 1100 / 2000 3600 1400 1575
Machine 2 Part D Part E Part F Part G Part G / Part F Part H

TOTAL SHOTS ACTUAL 1100 1650 1000 1300 1000 * 2 350 *2 / 900 1350
Machine 3 Part I Part J Park K

TOTAL SHOTS PLAN 500 1125 750 1125 1125 1125 800


theboyholty
Posting Yak Master

226 Posts

Posted - 2014-11-17 : 09:49:37
You'll have to explain how Part (which seems to be an integer) corresponds to Part A, B or C, also how PLANs fit into all this and what is meant by NO PLAN, TOTAL SHOTS ACTUAL and TOTAL SHOTS PLAN. In short you haven't provided enough information, unless I'm just being thick.

---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk A Bury FC supporters website and forum
Go to Top of Page
   

- Advertisement -