3 Replies - 868 Views - Last Post: 05 January 2016 - 04:10 PM

#1 O'Niel  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 378
  • Joined: 13-September 15

Crafting a specific select query in Access

Posted 18 November 2015 - 04:13 PM

Hello

I've got a problem with Access. I'm indeed doing an exercise from school but it's an old one, and by that not for points.

I basically have two tables, one includes information about (fictive) teachers, their name, first name, and ID. The second one includes specific subjects, there there's written which teacher ID gives which subject for how many hours.

Now I have to make a query which shows how many hours each teacher gives.
How would I have to do that? I guess step one is creating another column for the total hours? But the problem is, in table2 (See image) the name of the same teacher is displayed multiple times (if multiple subjects), in the result it's not.

Images:
URL: http://imgur.com/a/PBeKA

Translation (Dutch - English):
AantalLesuren - AmountOfLessonHours
Naam - Name
Voornaam - First name
Totaal aantal lesuren - Total amount of lesson hours

I know how to create select-queries, I only don't understand this exercise.

URL: http://imgur.com/AMf5giN

Thanks a lot!

This post has been edited by O'Niel: 18 November 2015 - 04:15 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Crafting a specific select query in Access

#2 RamonRobben  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 81
  • View blog
  • Posts: 538
  • Joined: 19-May 14

Re: Crafting a specific select query in Access

Posted 05 January 2016 - 03:26 PM

Writing my answer in both languages to get my point more clear.

Ik snap de tweede vraag niet helemaal maar hier beantwoord ik je eerst vraag.
I don't really get what you mean in your second question but heres my answer for the first.

Hoeft niet persee. Ik ben geen access expert maar ik heb wel wat kennis over querys.
Not neccessary. I'm not an access expert but I do know something about querys.

Krijg alle lesuren van verschillende vakken van 1 leraar in een array
Get hours from different classes from one teacher in an array
SELECT AantalLesuren WHERE LeraarId = 1



Ik weet niet hoe dat in access moet maar je moet dan door de array loopen en de uren bij elkaar optellen.
I'm not sure how its done in access but you should loop trough the array and count the hours together.

Maybe you could post some more info about what you mean in your second question.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13400
  • View blog
  • Posts: 53,482
  • Joined: 12-June 08

Re: Crafting a specific select query in Access

Posted 05 January 2016 - 03:45 PM

@RamonRobben - it's an english primary language forum.. you do not need to dual translate your text line by line.
Was This Post Helpful? 0
  • +
  • -

#4 O'Niel  Icon User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 378
  • Joined: 13-September 15

Re: Crafting a specific select query in Access

Posted 05 January 2016 - 04:10 PM

I solved the problem, what I needed was the DISTINCT keyword. ;)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1