A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Double Results in Query



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2009, 03:49 AM posted to microsoft.public.access.queries
Keiron_Dole
external usenet poster
 
Posts: 1
Default Double Results in Query

New to Access

I am trying to create a query that returns data from 2 tables. one table can
have multiple entries on one day per person and the other table will only
have one entry per person.

2 tables are

DataEntry - will have multiple entries per day per person
CallLog - one entry per person per day

SELECT DataEntry.OrderTakenBy, DataEntry.Company, DataEntry.Date, DataEntry.
Category, DataEntry.ShortCode, DataEntry.ContactName, DataEntry.PositionTitle,
DataEntry.PostDateExt, DataEntry.FirmPreview, DataEntry.AllorProgramCodes,
DataEntry.Units, DataEntry.value, DataEntry.MarketingCode, CallLog.TotalCalls,
CallLog.AvgTalkTime, CallLog.TotalTalkTime
FROM DataEntry INNER JOIN CallLog ON DataEntry.Date = CallLog.Date
WHERE (((DataEntry.Date)=[Enter Date]));

Any help would be greatly appreciated.

Cheers
Keiron

Ads
  #2  
Old December 8th, 2009, 02:44 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Double Results in Query

SELECT DataEntry.OrderTakenBy
, DataEntry.Company
, DataEntry.Date
, DataEntry.Category
, DataEntry.ShortCode
, DataEntry.ContactName
, DataEntry.PositionTitle
, DataEntry.PostDateExt
, DataEntry.FirmPreview
, DataEntry.AllorProgramCodes
, DataEntry.Units
, DataEntry.value
, DataEntry.MarketingCode
, CallLog.TotalCalls
, CallLog.AvgTalkTime
, CallLog.TotalTalkTime
FROM DataEntry INNER JOIN CallLog ON DataEntry.Date = CallLog.Date
WHERE (((DataEntry.Date)=[Enter Date]));

Can you explain WHAT results you want? If you want just one row returned for
each CallLog entry, then you need to decide how you are going to consolidate
the DateEntry fields for that date. DataEntry.Date is going to be the same
for every row for the specified date, but I assume that Company could vary
between records on the date.

Also, you talk about DataEntry and CallLog having entries per person, but I
don't see that used in your query. I would expect to see the join include
something like
FROM DataEntry INNER JOIN CallLog ON DataEntry.Date = CallLog.Date
AND DataEntry.PersonFieldID = CallLog.PersonIDField


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Keiron_Dole wrote:
New to Access

I am trying to create a query that returns data from 2 tables. one table can
have multiple entries on one day per person and the other table will only
have one entry per person.

2 tables are

DataEntry - will have multiple entries per day per person
CallLog - one entry per person per day

SELECT DataEntry.OrderTakenBy, DataEntry.Company, DataEntry.Date, DataEntry.
Category, DataEntry.ShortCode, DataEntry.ContactName, DataEntry.PositionTitle,
DataEntry.PostDateExt, DataEntry.FirmPreview, DataEntry.AllorProgramCodes,
DataEntry.Units, DataEntry.value, DataEntry.MarketingCode, CallLog.TotalCalls,
CallLog.AvgTalkTime, CallLog.TotalTalkTime
FROM DataEntry INNER JOIN CallLog ON DataEntry.Date = CallLog.Date
WHERE (((DataEntry.Date)=[Enter Date]));

Any help would be greatly appreciated.

Cheers
Keiron

  #3  
Old December 8th, 2009, 03:08 PM posted to microsoft.public.access.queries
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Double Results in Query

On Tue, 08 Dec 2009 02:49:01 GMT, "Keiron_Dole" [email protected] wrote:

You are also new to Relation Database Design, and it probably is the
hardest part to get right.
You need a better way to join these two tables, likely by ID value
(rather than current Date field).
Date and Value are reserved words. Don't use them for field names.
Calculated values such as AvgTalkTime should be calculated in a query,
and not stored in a table.

You may want to consider hiring a professional to get the database
setup properly. Then you can build upon this stable foundation.
"Microsoft Solution Provider" in your yellow pages may be a place to
start.

-Tom.
Microsoft Access MVP


New to Access

I am trying to create a query that returns data from 2 tables. one table can
have multiple entries on one day per person and the other table will only
have one entry per person.

2 tables are

DataEntry - will have multiple entries per day per person
CallLog - one entry per person per day

SELECT DataEntry.OrderTakenBy, DataEntry.Company, DataEntry.Date, DataEntry.
Category, DataEntry.ShortCode, DataEntry.ContactName, DataEntry.PositionTitle,
DataEntry.PostDateExt, DataEntry.FirmPreview, DataEntry.AllorProgramCodes,
DataEntry.Units, DataEntry.value, DataEntry.MarketingCode, CallLog.TotalCalls,
CallLog.AvgTalkTime, CallLog.TotalTalkTime
FROM DataEntry INNER JOIN CallLog ON DataEntry.Date = CallLog.Date
WHERE (((DataEntry.Date)=[Enter Date]));

Any help would be greatly appreciated.

Cheers
Keiron

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.