473,796 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

complicated query... help needed

I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those 2
fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is, never
run before the dates entered. I have 2 fields that I am looking at to
see if it is a 'new' product, those fields are hours and cases.
Any help would be greatly appreciated!

Norma
Nov 13 '05 #1
5 1499
"Norma" <nj**********@s uscom.net> wrote in message
news:20******** *************** ***@posting.goo gle.com...
I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those 2
fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is, never
run before the dates entered. I have 2 fields that I am looking at to
see if it is a 'new' product, those fields are hours and cases.
Any help would be greatly appreciated!

Norma


Off the cuff, I'd suggest using two (or even three) queries: one that
narrows the set to your first criteria, then another that has the secondary
criteria, and joins to the first. If you come up with a first draft and
post it here I'm sure someone, if not myself, can provide better guidance.
Nov 13 '05 #2
select x.job from (select t.job from t where t.fldDate between param1
and param2) as x
left join (select t.job, sum(t.cases) as sc, sum(t.hours) as sh,
t.fldDate from
t group by t.job, t.fldDate having t.flddate<param 1) as y on x.job =
y.job where y.job is null;

Norma <nj**********@s uscom.net> posted in
news:20******** *************** ***@posting.goo gle.com
I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those 2
fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is, never
run before the dates entered. I have 2 fields that I am looking at to
see if it is a 'new' product, those fields are hours and cases.
Any help would be greatly appreciated!

Norma


--
Phil
Nov 13 '05 #3
Phil,
I am trying to decipher what you wrote and put it into language that I
would understand. I am a novice in access SQL. Is there anyway you can
restate all that in laymans terms?

Thanks,
Norma

"Phil" <st***@basketba ll.net> wrote in message news:<Wd******* **********@news svr22.news.prod igy.com>...
select x.job from (select t.job from t where t.fldDate between param1
and param2) as x
left join (select t.job, sum(t.cases) as sc, sum(t.hours) as sh,
t.fldDate from
t group by t.job, t.fldDate having t.flddate<param 1) as y on x.job =
y.job where y.job is null;

Norma <nj**********@s uscom.net> posted in
news:20******** *************** ***@posting.goo gle.com
I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those 2
fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is, never
run before the dates entered. I have 2 fields that I am looking at to
see if it is a 'new' product, those fields are hours and cases.
Any help would be greatly appreciated!

Norma

Nov 13 '05 #4
"Norma" <nj**********@s uscom.net> wrote in message
news:20******** *************** ***@posting.goo gle.com...
I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those 2
fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is, never
run before the dates entered. I have 2 fields that I am looking at to
see if it is a 'new' product, those fields are hours and cases.
Any help would be greatly appreciated!


Post your table structure with some sample data and the output you need and
someone will be able to help you.
Nov 13 '05 #5
make a query on your table in the design screen. you want to return the
job and date fields of your table. in criteria for date field it should
be something like:
between [param1] and [param2]
save query and call it x or whatever.

make another one, same table and fields but also return the case and
hours fields.

hit summation button. in the summation row, the job field should be
'group by' the case and hours, 'sum' and the date field should be
'where' with criteria ' < [param1]'
save this as y or whatever

make a new query and select queries x and y and pick and drag the x.job
to the y.job to make a join line, right click the join line and choose
2. now you should have the join line with an arrow head on the y table.
Now return the x.job and y.job. Criteria for y.job should be 'is null'.
y.job can be cleared to not display.

if doesn't work post table fields and someone can write a query for cut
and paste. But you ought to try and learn this show you can do other
queries on your own.

Norma <nj**********@s uscom.net> posted in
news:20******** *************** ***@posting.goo gle.com
Phil,
I am trying to decipher what you wrote and put it into language that I
would understand. I am a novice in access SQL. Is there anyway you can
restate all that in laymans terms?

Thanks,
Norma

"Phil" <st***@basketba ll.net> wrote in message
news:<Wd******* **********@news svr22.news.prod igy.com>...
select x.job from (select t.job from t where t.fldDate between param1
and param2) as x
left join (select t.job, sum(t.cases) as sc, sum(t.hours) as sh,
t.fldDate from
t group by t.job, t.fldDate having t.flddate<param 1) as y on x.job =
y.job where y.job is null;

Norma <nj**********@s uscom.net> posted in
news:20******** *************** ***@posting.goo gle.com
I am trying to make a query pull data from between the dates I enter
in the parameter but also look back 'in time' to see where 2 other
fields have null values, and only pull data into the query if those
2 fields are null prior to the beginning date of my parameter.
The reason for this (to help make this a little clearer)is to pull
production into a query if it is a 'new' for the month. That is,
never run before the dates entered. I have 2 fields that I am
looking at to see if it is a 'new' product, those fields are hours
and cases. Any help would be greatly appreciated!

Norma


--
Phil
Nov 13 '05 #6

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

Similar topics

15
4551
by: Agoston Bejo | last post by:
Hi, I'm having trouble with implementing some constraints on the database level. An example: --Table A(AID, BID ref. B.BID, ATXT) --Table B(BID, CID ref. C.CID) --Table C(CID) upon insertion into or updating in A I would like to force that ATXT is unique with respect to CID, i.e.
10
2457
by: jqq | last post by:
SQL2K on W2Kserver I need some help revamping a rather complicated query. I've given the table and existing query information below. (FYI, changing the database structure is right out.) The current query lists addresses with two particular types ('MN30D843J2', 'SC93JDL39D'). I need to change this to (1) check each contact for address type 'AM39DK3KD9' and then (2) if the contact has type 'AM39DK3KD9' select types ('AM39DK3KD9',...
3
1449
by: Eagle | last post by:
Hi all, This one's drivin' me nuts. Any help would be appreciated. (Access 2000). I have 3 tables: tblTools: having the basic data of a tool and a field (txt) showing yes or no with regard to being in-stock. Unique toolNr is the primary key. tblOut: stores info on emloyee_ID and date of any occasion that the tool is being handed over to someone. (tblTools stock will be set to No). Primary
26
2180
by: Jeff | last post by:
Ok gang. Here is something complicated, well, at least to me anyway. Using Access DB I have a table in my DB called members. In that table, I have 2 tables I will be using "username" and "points" Now, I also have a table called all_matches. This table contains every match report. Over 25,000 of them. I have a "username" field an "outcome" field an "username1" field and "extra_match" field.
4
1628
by: Matthew Crouch | last post by:
i suck so much that i don't even know if this is a JOIN or a subquery or who-knows what. Here's the idea: I want to select two things at the same time (form one table) average for columnX and average for columnX where columnY=Z so i started of course with select avg(columnX) as avg1, avg(columnX) as avg2 from table where columnY=Z
8
1968
by: Nancy | last post by:
Greetings: First, I apologize if my posting format is improper. The code below does what I intended it to do, but presently only displays 1 table entry. I've grown it to this point, but really need it to loop through the table and do everything where data_store_no matches $store_no. I've tried placing where at a couple different points with no real success - it either doesn't work at all, exceeds the time allowed for a process...
0
481
by: Nick | last post by:
Hi, I have two tables Trade table and Cons table. Records are inserted in both the tables independent of each other. There are fields like Exc_Ref, Qty, Date in both the tables. I need to write a query which should give me records : 1. Where there is missing Exc_Ref value in either of the table. i.e. If Trade table has a Exc_Ref value but missing in Cons table then that
7
2308
by: MarkNeumann | last post by:
I'm coming from a Corel paradox background and moving into an Access environment. So I'm struggling with something that I think is probably way simpler than I'm making it out to be. Access 2007 WindowsXP SP2 What I have is a table in a subform that tracks dollars spent per project There is sub sub form that breaks down each dollar amount per fund. For example: sewer/water/streets/parks. In the sub sub form the fields I'm having...
20
5246
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to write the parameter, I want to select a row from the listbox and after clicking in a button, the query to automatically take the current value of listbox as the needed parameter and then to load the query. (The Inputbox for "Enter Parameter" will...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.