473,405 Members | 2,421 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,405 software developers and data experts.

help with a simple query

Hi, Can someone help with a simple query?

I have a table with the following.
[maintable]
Firstname
Lastname
InterviewerID1
InterviewerID2
InterviewerID3
...
InterviewerID9
InterviewerID10

In another table I have:
[Interviewer]
InterviewerID
InterviewerName

when I create a query to show the full name with all the interviewers, I
need to add the Interviewer table 10 times. Is this correct?

I have a feeeling it is coz it worked initially. Then as the data
increases, it takes forever to return the results..

I have indexed the tables etc so at a lost as to why it takes almost
forever to return.

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Feb 13 '06 #1
5 1719
No, that is the wrong structure.

You need 3 tables: one for person, one the the interviews, and one for the
interviews:

Client table (one record per person):
ClientID AutoNumber primary key
FirstName Text
LastName Text
ApplicationDate Date/Time (when person first applied for an interview)
...

Interviewer table (one record per interviewer):
PersonID AutoNumber primary key
FirstName Text
LastName Text
...

Interviews table (one record for each interview):
ClientID who was interviewed
InterviewerID who conducted the interview
InterviewDateTime when the interview was conducted.

You can now have as many or as few interviews as you need for any person,
with any interviewer, and sort them by the InterviewDateTime. You can also
do other stuff such as querying how many times a person has been
interviewed, count how many interviews each interviewer conducted in a
month, and heaps more.

Whenever you see repeating fields such as InterviewID1, Interviewer2, ...,
it *always* means that you need a related table with one column to hold that
info, instead of repeating fields in one table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"jim Bob" <fr****@gmail.com> wrote in message
news:4B****************@news.uswest.net...
Hi, Can someone help with a simple query?

I have a table with the following.
[maintable]
Firstname
Lastname
InterviewerID1
InterviewerID2
InterviewerID3
..
InterviewerID9
InterviewerID10

In another table I have:
[Interviewer]
InterviewerID
InterviewerName

when I create a query to show the full name with all the interviewers, I
need to add the Interviewer table 10 times. Is this correct?

I have a feeeling it is coz it worked initially. Then as the data
increases, it takes forever to return the results..

I have indexed the tables etc so at a lost as to why it takes almost
forever to return.

Feb 13 '06 #2
Thanks for your reply Allen.

The reason why I had it like this was because in my table i actually
have
[Maintable]
DBID
LastName
FirstName
DOB
CampusInterviwerID1 ->staff Table
CampusInterviwerID2 ->staff Table
CampusInterviwerID3 ->staff Table
OnsiteInterviewerID1 ->staff Table
OnsiteInterviewerID2 ->staff Table
OnsiteInterviewerID3 ->staff Table
SitePreferenceID1 ->site pref Table
SitePreferenceID2 ->site pref Table
SitePreferenceID3 ->site pref Table
ManagerID ->staff Table
BuddyID ->staff Table

[staffTable]
StaffID
StaffName

[siteTable]
SiteID
SiteName.

are you saying that this structure is not correct? Because at the moment
it works ok. When I do a query in order to show all the information just
takes a long time.

Your help is much appreciated.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Feb 13 '06 #3
That stucture is not correctly normalized, i.e. there are better ways to
design this.

If you do not wish to design it correctly and gain the simplicity,
flexibility, and queriability that a normalized structure would give, you
should still be able to get workable performance out of this structure.
Presumably the StaffID is primary key in staffTable? If so, you could open
the Relationships window (Tools menu), and drag the Staff table in multiple
times. Access will alias these copies as staffTable_1, staffTable_2, etc.
You can then create a relationship between one of the fields in Maintable
and one of the copies of staffTable, until all fields have been related. Be
sure to check the box for Referential Integrity in each case.

That will cause Access to create the foreign key indexes. You should now get
good performance, unless you have criteria that do not allow the indexe to
be used. Or - quite possibliy with your awkward structure - the critiera
might be very convoluted to get the answers you need.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"jim Bob" <fr****@gmail.com> wrote in message
news:Wy****************@news.uswest.net...
Thanks for your reply Allen.

The reason why I had it like this was because in my table i actually
have
[Maintable]
DBID
LastName
FirstName
DOB
CampusInterviwerID1 ->staff Table
CampusInterviwerID2 ->staff Table
CampusInterviwerID3 ->staff Table
OnsiteInterviewerID1 ->staff Table
OnsiteInterviewerID2 ->staff Table
OnsiteInterviewerID3 ->staff Table
SitePreferenceID1 ->site pref Table
SitePreferenceID2 ->site pref Table
SitePreferenceID3 ->site pref Table
ManagerID ->staff Table
BuddyID ->staff Table

[staffTable]
StaffID
StaffName

[siteTable]
SiteID
SiteName.

are you saying that this structure is not correct? Because at the moment
it works ok. When I do a query in order to show all the information just
takes a long time.

Your help is much appreciated.
Thanks

Feb 13 '06 #4
Hi Allen,
I understand your first example fine.

I agree that in my second example it is not correctly normalized. I have
racked my brains out to try to find a better way. Can you give me an
example of how to normalize it properly?

Is it something that is straight forward and I have completely missed or
does it take a bit of time?

Thanks a lot!

*** Sent via Developersdex http://www.developersdex.com ***
Feb 13 '06 #5
Please read my first reply for an example of how to normalize it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"jim Bob" <fr****@gmail.com> wrote in message
news:Az***************@news.uswest.net...
Hi Allen,
I understand your first example fine.

I agree that in my second example it is not correctly normalized. I have
racked my brains out to try to find a better way. Can you give me an
example of how to normalize it properly?

Is it something that is straight forward and I have completely missed or
does it take a bit of time?

Feb 13 '06 #6

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

Similar topics

9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
3
by: Mike | last post by:
I have had alot of problems with my query, I have a two tables of informations and just need a simple Query to get what I want but it is turning out not to be so simple. Table 1 Has the following...
6
by: Mike | last post by:
I have had alot of problems with my query, I have a two tables of informations and just need a simple Query to get what I want but it is turning out not to be so simple. Table 1 Has the following...
1
by: remove | last post by:
Hi all, I have a fairly simple database containing details of broadcast news reports. Each record contains information about the programme title, date, time, presenter, and details of the...
2
by: schoultzy | last post by:
Hello Everyone, This is probably a simple fix so be kind when/if you reply. The query below retrieves information for individuals based on a column named ATTRIB_DEF, and assorted other columns;...
8
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a...
2
by: googlegroups.dsbl | last post by:
I'm really confused here, and am wondering if someone knows what could be the issue with my TableAdapter query. A few months ago, I created a really neat program that has th ability to search by...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: rogynskyy | last post by:
Hi guys, I'm running MSDE 2000 A on Win XP I've got a database with several tables, all of the tables display data in query manager. I wrote this simple query: Select
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
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.