creating additional lines of data in a query
I have a database that tracks out of service vehicles.
As seen below, there is an initial out of service date and an end date.
I am tasked with creating a query that shows how many vehicles are out of service each day.
As seen in the example below, a simple count by “Report_Date” will give me the count of vehicles out of service each day, but will not count the vehicles that are out of service from the previous day.
For vehicles that are returned to service the same day they break down, no problems.
For vehicles that are out of service for multiple days creates a problem for me.
Table Example:
Vehicle
Start_Date End_Date Days_Out_of_Service
Report_Date Comments
V12 10/1/2013
10/1/2013 1
10/1/2013
V20 10/1/2013
10/3/2013 3
10/1/2013
V14 10/2/2013
10/2/2013 1
10/2/2013
V06 10/2/2013
10/3/2013 2
10/2/2013
Question:
How can I create a query that will insert additional lines so the vehicle will have a line for each day it is out of service as shown below?
(Note: the repeated line items will be used for other data querying also, so it will be helpful to have the additional line items.)
Vehicle
Start_Date End_Date Days_Out_of_Service
Report_Date Comments
V12 10/1/2013
10/1/2013 1
10/1/2013
V20
10/1/2013 10/3/2013
3 10/1/2013
V20
10/1/2013 10/3/2013
3 10/2/2013
V20
10/1/2013 10/3/2013
3 10/3/2013
V14 10/2/2013
10/2/2013 1
10/2/2013
V06
10/2/2013 10/3/2013
2 10/2/2013
V06
10/2/2013 10/3/2013
2 10/3/2013
Thank you!
Anwsers to the Problem creating additional lines of data in a query
Download SmartPCFixer to Fix It (Free)
You'll need a little auxiliary table to do this: I call mine Num, with one Long Integer field named N as the primary key (and only field).
Fill this table manually (or copy and paste from an Excel spreadsheet using Fill Series) with numbers from 0 through
10000 or so.
You can then use a query like
SELECT [Vehicle], [Start_Date], [End_Date], DateDiff("d", [Start_Date], [End_Date] AS Days_Out_Of_Service, DateAdd("N", [Start_Date]) AS Report_Date
FROM yourtablename, Num
WHERE Num.N <= DatedDiff("d", [Start_Date], [End_Date]);
Running System Update Readiness Command
On running the System Update readiness Command, it will Detect & Replace Incorrect Registry data with the Correct one. Which may ultimately Solve creating additional lines of data in a query in Windows.
- Open CMD as Administrator by Simply Right Clicking on Start button > Command Prompt (Admin).
- Now Type or Copy paste "DISM.exe /Online /Cleanup-image /Scanhealth" and hit Enter,
- Now again Type or Copy paste this "DISM.exe /Online /Cleanup-image /Restorehealth" and hit Enter.
- Close the Command Prompt Window because we are done.
Try and see if you still get the same error creating additional lines of data in a query in your Windows.
Note: You may be prompted to enter your administrator's password when you try to execute certain system tasks!
Recommended Method to Fix the Problem: creating additional lines of data in a query:
How to Fix creating additional lines of data in a query with SmartPCFixer?
1. Download SmartPCFixer. Install it on your computer.
2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.
3. When the Fixing part is done, your computer has been speeded up and the errors have been fixed
Related: How Can You Update & Download NVidia 6100, 6800 GS/XT Display Driver v.260.89 WHQL,Where to Download NVidia GeForce 8800 GT WHQL-certified driver v.196.21,How to Update & Download NVidia GeForce Go 7400 Display Driver v.260.19.12,[Solved] Download NVidia GeForce GTX 460M Driver v.331.82,Download NVidia Quadro Plex Model IV VGA Driver v.304.43 Certified,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.8.17.12.6686,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.11.6.0.1030,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.9.3.0.1019,Method to Update & Download ASUS K41VD Intel INF Update Driver v.9.1.1.1015,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: Tech Support: Contacting Customer Service for password reset,Troubleshoot:Conversion of Excel & Word Starter 2010 files by Microsoft without Warning or Notice,Troubleshoot:Control panel program options,How to Fix Problem - Connection being dropped?,cpu memory thrashing close to 100%,Closing Internet Explorer causes error,Compare 2 Tables and Calculate the PROFIT Faster,Computer goes to Windows Boot Manager after Start,Connect to one of my network computer remotely when don't allow exception box Marked,computer locking up randomly
No comments:
Post a Comment