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

How can I combine three tables in a View or a Procedure?

Hello everyone. I hope someone can help me with this. I have 3
columns called EMPLOYEE_TEST, TEST_QA and EMPLOYEE_TEST_ANSWER.

The TEST_QA table contains the following:

TEST_QA_ID | PROC_TEST_ID | TEST_QA_QUESTION | TEST_QA_CORRECT
-----------+--------------+------------------+-----------------
3| 1|First Question | 5
4| 2|Second Question | 1
5| 1|Third Question | 2
6| 3|Fourth Question | 1
7| 3|Fifth Question | 5
8| 3|Sixth Question | 2
9| 3|Seventh Question | 3

The EMPLOYEE_TEST table contains the following:

EMPLOYEE_ID | EMPLOYEE_TEST_ID
------------+------------------
3| 7

The EMPLOYEE_TEST_ANSWER table contains the following:

EMPLOYEE_TEST_ID | TEST_QA_ID | TEST_QA_CORRECT
-----------------+------------+-----------------
7| 9| 5
7| 8| 2
7| 6| 1

From these three tables I can see that the employe with ID = 3 has
answered 3 questions and two of them are correct. What I would like
to be able to do is to represent this in a view (if possible)

EMPLOYEE_ID | EMPLOYEE_TEST_ID | TOTAL_ANSWERS | CORRECT | WRONG
------------+------------------+---------------+---------+-------
3| 7| 2| 2| 1

Thank you in advance...

Emilio
Jul 19 '05 #1
2 3047
Who receives the university credits if we help, us or you?

Daniel
Jul 19 '05 #2
en******@attglobal.net (Emilio) wrote in message news:<75**************************@posting.google. com>...
Hello everyone. I hope someone can help me with this. I have 3
columns called EMPLOYEE_TEST, TEST_QA and EMPLOYEE_TEST_ANSWER.
You mean three TABLES, not columns.
Tables contain rows which are composed of columns which contain
values.

[]
From these three tables I can see that the employe with ID = 3 has
answered 3 questions and two of them are correct. What I would like
to be able to do is to represent this in a view (if possible)


Look in your textbook for the word JOIN. Learn that before moving on
to creating views and procedures.
Jul 19 '05 #3

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

Similar topics

6
by: D Bull | last post by:
I'm trying to use sp_help to get information on my tables. I can use sp_help alone to get a list of objects (including user tables), but when I pass a table name as an argument I get the following...
8
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: ...
3
by: (Pete Cresswell) | last post by:
Seems like creating a #temp table is kind of useless because it cannot be bound to a subform. OTOH, seems like a waste of resources to populate work tables in the "real" database - both because...
5
by: Jamie Pittman via AccessMonster.com | last post by:
I have two tables with 5000 entries on them. One is based for regular time with several variables example (employee name, date,time in and out, code, customer, building) I have another table that...
5
by: Grzegorz Danowski | last post by:
Hi I have two databases: Customers and Operations. In Customers database I have made a view based on a few tables from both Customers and Operations (left join - customers without any...
1
by: MackTheKnife | last post by:
I have the following 3 SQL statements that need to be combined, if possible. The output of one feeds the input of the next. I need to view all of the defined output fields (the output needs to be...
3
by: Fran | last post by:
(SQL 2005) I'm looking to create a stored procedure to first "select name from sys.databases where name like '%site'" then pass each name to the following using some kind of loop "USE @name select...
2
by: Emilio | last post by:
Hello everyone. I hope someone can help me with this. I have 3 columns called EMPLOYEE_TEST, TEST_QA and EMPLOYEE_TEST_ANSWER. The TEST_QA table contains the following: TEST_QA_ID |...
13
by: MNNovice | last post by:
I have three tables, tblAP, tblPayroll and tblAllocation. Each records three separate expenses. All three are related by FK ECHOID, each has common fields such as AccountNo, FundNo, GrantNo,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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...
0
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,...
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.