Query between two tables

JCabral

New Member
Joined
Feb 11, 2017
Messages
13
HI
I needed some help to make a query, to two tables that I have in an access file, which I only use to store data.
The query is done from Excel, but my difficulty is how to define the statement in SQL, since I'm not very knowledgeable about it either.

So that's it, I have two tables, tblTasks and tblRoutes.

In tblTasks I have the data referring to each Task, namely who does it (OIA), its designation (TASK DESIGNATION) and the extension of that task (INSPECTION EXTENSION).

In the table tblRoutes I have the data for each OIA to do during the week, that is, I have for a given OIA the name of the route it has to do (ROUTE) and what tasks it has to do on Monday, Tuesday, Wednesday, Thursday and Friday.

Important: The tables must have this format and I cannot change them.

The query I need to do is; for a given OIA and for a given Route I need to know the inspection extension (INSPECTION EXTENSION) carried out for each day of the week.

NOTE: I don't know if it's possible to put my access file here?

Thanks
 

Attachments

  • tblRoutes.PNG
    tblRoutes.PNG
    8.5 KB · Views: 8
  • tblTasks.PNG
    tblTasks.PNG
    9.7 KB · Views: 9
  • tblRoutesDATA.PNG
    tblRoutesDATA.PNG
    28.2 KB · Views: 10
  • tblTasksDATA.PNG
    tblTasksDATA.PNG
    27.3 KB · Views: 9
Yeah, that is usually the solution to issues like this - do a separate query for each day of the week, and use "UNION" to see each sub-query together.
Just note that the results of UNION queries are NOT updateable.
Please remember that I'm a beginner, when you say it's not updateable, what do you mean? As I mentioned in the post, the queries will be carried out from Excel, that is, whenever I need to, I make the query, the moment I make the query the data is updated.
I can always do 5 queries, one for each day of the week.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
It means that you will not be able to edit (add, delete, modify) any data in the query that is returned.
You can report on the data using a Union query, you just cannot make any changes to the data through the Union query.
 
Upvote 0
That is not a problem, because the data in the tables is changed separately, I just want to consult the values for each day of the week, given an OIA and a ROUTE
 
Upvote 0

Forum statistics

Threads
1,216,500
Messages
6,131,016
Members
449,615
Latest member
Nic0la

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top