Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pad out query with all dates

Status
Not open for further replies.

apkohn

Technical User
Joined
Nov 27, 2000
Messages
62
Location
AU
Hey all,

I have a table in my database that has a reading recorded against a particular date.

eg:
[tt]ReadingDate Reading
16/01/2001 100
18/01/2002 250
21/01/2002 150[/tt]

Now, I would like a query, that will return a record for each day coverred in the above range.

For example, I would like to get
[tt]AllDate Expr2
16/01/2002 [CalculatedVal]
17/01/2002 [CalculatedVal] <- New line
18/01/2002 [CalculatedVal]
19/01/2002 [CalculatedVal] <- New line
20/01/2002 [CalculatedVal] <- New line
21/01/2002 [CalculatedVal][/tt]

Does anyone know how to do this in SQL. I know it is possible in VBA, but I want to keep it as a saved query.
 
Oops, I mucked up the second table. There should be a column for the &quot;Reading&quot;, which will read Null if the line is created.

Also, I am aware that I can create a table with every calendar day in it, and join it to the above table (showing all records in Calendar), but would like to avoid that too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top