473,387 Members | 1,540 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,387 software developers and data experts.

Returning specific data on a query

I'm rusty on Access - have not used it since 2000. Currently have Access 2013.

I would like to have the query return the first 3 months of data on oil production based on the completion date of the well.

Expand|Select|Wrap|Line Numbers
  1. Data fields:
  2. Completion Date         Production date:
  3. 1/9/2009                1/1/2009
  4. 1/9/2009                2/1/2009
  5. 1/9/2009                3/1/2009
  6. 1/9/2009                4/1/2009
  7. 1/9/2009                1/1/2010 
Data expample above is for one well. I need the query to look at the completion date and return the first 3 production date data lines. Not all wells have a january completion date a sum type query won't work because wells that start in december would have production in jan-mar.

Hope someone can help...I'm feeling very rusty..
Dec 18 '13 #1
7 1408
zmbd
5,501 Expert Mod 4TB
that's all of the data?
nothing to indicate the well such as:
Expand|Select|Wrap|Line Numbers
  1. Data fields:
  2. WellExample   Completion Date         Production date:
  3. 1                1/9/2009                1/1/2009
  4. 1                1/9/2009                2/1/2009
  5. 1                1/9/2009                3/1/2009
  6. 2                1/9/2009                4/1/2009
  7. 2                1/9/2009                1/1/2010 
Dec 18 '13 #2
NeoPa
32,556 Expert Mod 16PB
To help you, we'd need you to specify the problem more clearly. How is "first three months" defined?
Dec 19 '13 #3
Thank you for you help! The first 3 months is defined as the first 3 months after the completion date. So if a well is completed on 1/1/10 - I need the query to return the production data associated with 1/1/10, 2/1/10 and 3/1/10.
Dec 19 '13 #4
zmbd
5,501 Expert Mod 4TB
From the data you've provided, I really don't see any reasonable means to reliably return the results you desire.

The best I can tell you is that you either have not provided enough of your dataset to for us to help and/or your database design has failed you in the most miserable way possible...

So what I'm going to ask you to do is:
1) Go back to your data. Almost anything in addition to what you have here might help.

2) reveiw the following sites for how to design a RDMS.
---
MS Access 2010 Tutorials
Access Basics - By Crystal
Micrsoft: Office2010 tutorials
Microsoft: Getting started with Access 2010
> Database Normalization and Table Structures.
---

3) I am abhorent to provide the following:
Based on the data you posted in #1

Expand|Select|Wrap|Line Numbers
  1. SELECT TOP 3 Table3.Completion , Table3.Production 
  2. FROM Table3
  3. WHERE ((([Production]>=[Completion]));
  4.  
This will return the first three records wherein the production date is greater than 1/9/2009 the 2/1/2009 - 4/1/2009 IT will not return the 1/1/2009 because that date is greater than the 1/9/2009
FURTHERMORE: Even if you add 100 more records, it is only going to return 2/1/2009 - 4/1/2009

You see, you've really not given us anything to really work with.
Dec 19 '13 #5
NeoPa
32,556 Expert Mod 16PB
It may be as simple as :
Expand|Select|Wrap|Line Numbers
  1. SELECT [WellID]
  2.      , [Completion]
  3.      , [Production]
  4. FROM   [YourTable]
  5. WHERE  ([Production] Between [Completion] And DateAdd('m',3,[Completion]))
Dec 20 '13 #6
zmbd
5,501 Expert Mod 4TB
yes, but no [WellID] offered either in post 1 nor 4; however, I should have thought of the "Between"
Dec 20 '13 #7
NeoPa
32,556 Expert Mod 16PB
No need to beat yourself up about it Z. Sometimes it occurs to one and other times not. It often depends on how clearly the question is understood at the time.

That, of course, depends on how it's written which, in turn, depends on the efforts of the poster, as well as - and here's the kicker - their experience. Many a well-intentioned member has done their best to make the question clearer, only to have exactly the reverse effect. Simply because they lack the experience to realise what things are most helpful and what things are not so much.

For those of us wih more experience it seems just common sense, but often that's because we're so used to dealing with such situations.

I suspect Domino felt he was simplifying the whole matter by leaving out any reference to the Well info in the explanation.
Dec 20 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: 'bonehead | last post by:
Greetings, I'd like to figure out some syntax for retrieving the data from a table when I don't know all the of field names. What I do know are, the name of the table, the names of the primary...
4
by: i. dzhugashvili | last post by:
I'm hoping someone can help me here. I'm having problems using a function to get the search criteria for a column in the QBE grid. The column's data type is Long and the problem is that if I...
4
by: Daisy | last post by:
Let's say I've got a forum, where users can be moderators of each forum. Tables look like this: USER -------- user_key name FORUM
3
by: etam | last post by:
Hi, I need a very specific data control. It has to show multiple rows. It has to show data from database, such as id, name, etc. It has to allow user to update few of them. And the most...
3
by: chauser | last post by:
I have a query that is supposed to pull data from the table based on the unit that is selected from a combo box on a form. I have the query pulling a specific unit but I want the user to be able to...
3
by: printline | last post by:
Hello All I need a little help with a phph script to display some specific data from a mysql table. I have a mysql table with 4 columns and 10 rows. I want to display fx. data from row 4, 6, 8...
3
by: Serenityquinn15 | last post by:
Hi! I was wondering if it is possible to get the specific data coming from SQL Server 2000 and append it to my MS Access Table through VB Code???? If it so, please advise me on how i can do this...
1
by: Question123 | last post by:
Hi friends I am trying to develop windows application with C#.Net. With using Bloomberg API. But i am unable to get Industry specific data from bloomberg. such as (Top Performing...
2
by: cheweedog | last post by:
Can't set the open form by specific data. The form fields don't appear to choose. Trying to link number to number. One form contains a field called number, but does not appear as a choice to <> to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.