Subtracting 2 query fields in another query

G

Guest

I have a query that takes year to date data as of two weeks ago and subtracts
out from another query that has year to date date as of today in it in order
to tell me what has transpired in the last two weeks. My problem is in the
last two weeks we added a job to the system and someone charged it. On my
comparison query however the new information will not come up. I have the
join properties set to equal (#). How can I get the new information to come
over?
 
G

Guest

I have the fields joined on the Job# which is what both queries have in
common. However, the older query does not have this job# on it and the new
one does.
If I change it to #2 (including all records from the new query and only the
records that match to the old query) I get the job# to come up but no data on
the rest of the line.
 
G

Guest

I get the job# to come up but no data on the rest of the line.
What data would you expect when there are no records?

Post your query SQL statement.
 
G

Guest

SELECT [CY A028 GRPD QUERY].[Job#], [CY A028 GRPD QUERY]![40]-[CY A028-B GRPD
QUERY]![40] AS 40Diff, [CY A028 GRPD QUERY]![41]-[CY A028-B GRPD QUERY]![41]
AS 41diff, [CY A028 GRPD QUERY]![43]-[CY A028-B GRPD QUERY]![43] AS 43Diff,
[CY A028 GRPD QUERY]![44]-[CY A028-B GRPD QUERY]![44] AS 44Diff, [CY A028
GRPD QUERY]![45]-[CY A028-B GRPD QUERY]![45] AS 45Diff, [CY A028 GRPD
QUERY]![46]-[CY A028-B GRPD QUERY]![46] AS 46Diff, [CY A028 GRPD
QUERY]![47]-[CY A028-B GRPD QUERY]![47] AS 47Diff, [CY A028 GRPD
QUERY]![48]-[CY A028-B GRPD QUERY]![48] AS 48Diff, [CY A028 GRPD
QUERY]![49]-[CY A028-B GRPD QUERY]![49] AS 49Diff, Nz([41diff],0) AS Expr1
FROM [CY A028 GRPD QUERY] LEFT JOIN [CY A028-B GRPD QUERY] ON [CY A028 GRPD
QUERY].[Job#] = [CY A028-B GRPD QUERY].[Job#];

The new data is in the CY A028 GRPD QUERY but not on the CY A028-B GRPD
QUERY. So I was hoping to bring over the new data. Thanks Regina
 
G

Guest

The new data is in the CY A028 GRPD QUERY but not on the CY A028-B GRPD
QUERY. So I was hoping to bring over the new data. Thanks Regina
If there is no [CY A028-B GRPD QUERY].[Job#] then the only data to show will
be [CY A028 GRPD QUERY] in the query results.
UNLESS you do this to everything --
[CY A028 GRPD QUERY]![40]-NZ([CY A028-B GRPD QUERY]![40],0) AS 40Diff,
add NZ(
,0)
to every item.
--
KARL DEWEY
Build a little - Test a little


Regi said:
SELECT [CY A028 GRPD QUERY].[Job#], [CY A028 GRPD QUERY]![40]-[CY A028-B GRPD
QUERY]![40] AS 40Diff, [CY A028 GRPD QUERY]![41]-[CY A028-B GRPD QUERY]![41]
AS 41diff, [CY A028 GRPD QUERY]![43]-[CY A028-B GRPD QUERY]![43] AS 43Diff,
[CY A028 GRPD QUERY]![44]-[CY A028-B GRPD QUERY]![44] AS 44Diff, [CY A028
GRPD QUERY]![45]-[CY A028-B GRPD QUERY]![45] AS 45Diff, [CY A028 GRPD
QUERY]![46]-[CY A028-B GRPD QUERY]![46] AS 46Diff, [CY A028 GRPD
QUERY]![47]-[CY A028-B GRPD QUERY]![47] AS 47Diff, [CY A028 GRPD
QUERY]![48]-[CY A028-B GRPD QUERY]![48] AS 48Diff, [CY A028 GRPD
QUERY]![49]-[CY A028-B GRPD QUERY]![49] AS 49Diff, Nz([41diff],0) AS Expr1
FROM [CY A028 GRPD QUERY] LEFT JOIN [CY A028-B GRPD QUERY] ON [CY A028 GRPD
QUERY].[Job#] = [CY A028-B GRPD QUERY].[Job#];

The new data is in the CY A028 GRPD QUERY but not on the CY A028-B GRPD
QUERY. So I was hoping to bring over the new data. Thanks Regina

KARL DEWEY said:
What data would you expect when there are no records?

Post your query SQL statement.
 
G

Guest

Karl,

I will give that a try. Thanks for your help. I'm so glad this forum is
here! Regi

KARL DEWEY said:
QUERY. So I was hoping to bring over the new data. Thanks Regina
If there is no [CY A028-B GRPD QUERY].[Job#] then the only data to show will
be [CY A028 GRPD QUERY] in the query results.
UNLESS you do this to everything --
[CY A028 GRPD QUERY]![40]-NZ([CY A028-B GRPD QUERY]![40],0) AS 40Diff,
add NZ(
,0)
to every item.
--
KARL DEWEY
Build a little - Test a little


Regi said:
SELECT [CY A028 GRPD QUERY].[Job#], [CY A028 GRPD QUERY]![40]-[CY A028-B GRPD
QUERY]![40] AS 40Diff, [CY A028 GRPD QUERY]![41]-[CY A028-B GRPD QUERY]![41]
AS 41diff, [CY A028 GRPD QUERY]![43]-[CY A028-B GRPD QUERY]![43] AS 43Diff,
[CY A028 GRPD QUERY]![44]-[CY A028-B GRPD QUERY]![44] AS 44Diff, [CY A028
GRPD QUERY]![45]-[CY A028-B GRPD QUERY]![45] AS 45Diff, [CY A028 GRPD
QUERY]![46]-[CY A028-B GRPD QUERY]![46] AS 46Diff, [CY A028 GRPD
QUERY]![47]-[CY A028-B GRPD QUERY]![47] AS 47Diff, [CY A028 GRPD
QUERY]![48]-[CY A028-B GRPD QUERY]![48] AS 48Diff, [CY A028 GRPD
QUERY]![49]-[CY A028-B GRPD QUERY]![49] AS 49Diff, Nz([41diff],0) AS Expr1
FROM [CY A028 GRPD QUERY] LEFT JOIN [CY A028-B GRPD QUERY] ON [CY A028 GRPD
QUERY].[Job#] = [CY A028-B GRPD QUERY].[Job#];

The new data is in the CY A028 GRPD QUERY but not on the CY A028-B GRPD
QUERY. So I was hoping to bring over the new data. Thanks Regina

KARL DEWEY said:
I get the job# to come up but no data on the rest of the line.
What data would you expect when there are no records?

Post your query SQL statement.

--
KARL DEWEY
Build a little - Test a little


:

I have the fields joined on the Job# which is what both queries have in
common. However, the older query does not have this job# on it and the new
one does.
If I change it to #2 (including all records from the new query and only the
records that match to the old query) I get the job# to come up but no data on
the rest of the line.

:

I have the join properties set to equal (#).
What field did you join on?

--
KARL DEWEY
Build a little - Test a little


:

I have a query that takes year to date data as of two weeks ago and subtracts
out from another query that has year to date date as of today in it in order
to tell me what has transpired in the last two weeks. My problem is in the
last two weeks we added a job to the system and someone charged it. On my
comparison query however the new information will not come up. I have the
join properties set to equal (#). How can I get the new information to come
over?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top