473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Query Generation - repeating previous value

Hi all,

I can't tell if I'm just being a spaccer, or whether this is tricky.
Here goes.

(Please note - this is a dummy example, for ease of explaining.)

So, I have a table with three fields:

ID
Date
Value

ID and Date together are the primary key. Essentially what it's for is
this: ID is, say, a product (oranges, apples, pears, grapes). Value is
the price of said product. What I want is the table to contain
information just when the price changes. So there's an entry for each
product at the start of time, then just new records when the price
changes.

Then, I want to have a query/report/printable data showing me the
price of each product over time, with it filling in the blanks where
the price has stayed the same.
So, we'd have something like this:

Table Data
ID........Date.........Value
Oranges...01/01/2004...30
Oranges...01/02/2004...32
Oranges...01/04/2004...35
Apples....01/01/2004...23
Apples....01/03/2004...24
Apples....01/04/2004...25
And I want to turn that into

Query Output
Date......01/01/2004...01/02/2004...01/03/2004...01/04/2004
Oranges...30...........32...........32...........3 5
Apples....23...........23...........24...........2 5
So, what do I need to do in terms of queries, guys? I'm using Access
97, if it makes a huge amount of difference.
Nov 12 '05 #1
1 1022
"Uncle Mike" <bi*********@ntlworld.com> wrote in message
news:9a**************************@posting.google.c om...
Hi all,

I can't tell if I'm just being a spaccer, or whether this is tricky.
Here goes.

(Please note - this is a dummy example, for ease of explaining.)

So, I have a table with three fields:

ID
Date
Value

ID and Date together are the primary key. Essentially what it's for is
this: ID is, say, a product (oranges, apples, pears, grapes). Value is
the price of said product. What I want is the table to contain
information just when the price changes. So there's an entry for each
product at the start of time, then just new records when the price
changes.

Then, I want to have a query/report/printable data showing me the
price of each product over time, with it filling in the blanks where
the price has stayed the same.


Use a calendar table with all the dates you are ever likely to need and join
to this table iin your query.
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
2
by: Willem | last post by:
Hi there, I'm sort of new with doing much record manipulation with queries. Up till now I've been programming VBA and doing record looping to get my results. This works fine but tends to get...
1
by: Uncle Mike | last post by:
Hi all, I can't tell if I'm just being a spaccer, or whether this is tricky. Here goes. (Please note - this is a dummy example, for ease of explaining.) So, I have a table with three...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
3
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the...
9
by: jardar.maatje | last post by:
I am logging scientific data. For this a normal relationship database is not idéal but I am going to try it. I have basically three tables like: datarecord: * idx - integer * time - datetime...
6
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table...
2
by: Wade | last post by:
I am pretty new to Access, especially writing code, but I found code on the web to do just what I want and it is posted below. It returns a field value from a previous record. I found the code at:...
0
by: CJM | last post by:
I have a fairly simple ASP application talking to an Oracle 10g DB using a mixture of ADO (OraOLEDB) and OO4O - the query here concerns some ADO code. One part of the application records...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.