Query for single column based on ID and fkID

TB11

Member
Local time
Yesterday, 18:09
Joined
Jul 7, 2020
Messages
84
Hi. I have 2 tables.
Table1 IDProject, ProjectDate (this table has only 1 date per IDProject)
Table 2 IDProjectGroup, fkProject, GroupDate (this table has 1 or multiple dates, all relating to the IDProject from table 1, but the date in table 2 is not a duplicate of date from table 1)

Wish list for query: I would like to have one column for a totals query, that shows both the ProjectDate from table 1 and the GroupDate from table 2. I need this single column for count, min and max in the totals query.

I can't seem to get the single column needed. I've tried different inner joins, no joins, separate queries, etc.

Is this something I can do with a query or do I need to restructure table 1?
 
Perhaps showing some sample data might help understand what you want?
 
If you need to evaluate the values together, then they should probably be in the same table. I think 1 paragraph without any database jargon in it that explains what this data represents would be helpful as well as 2 sets of sample data:

A. STarting data from your tables. Include table and field names and enough data to cover all cases.

B. Expected results of A. Show us what data you expect to end up with when you feed in the data from A above.

Again, 2 sets of data--starting and expected results.
 
Sorry about that. Sample data:
Table1
IDProject , ProjectDate
22 , 7/30/2021
25, 8/1/2021
28, 8/2/20211

Table 2
IDProjectGroup, fkProject, GroupDate
15 , 22, 7/31/2021
16, 22, 8/1/2021
17, 22, 8/2/2021
18 , 25 , 8/2/2021
19 , 28, 8/3/2021
20, 28 , 8/4/2021
21, 28 , 8/7/2021

Wish list:
IDProject, AllDates
22 , 7/30/2021 (from table 1)
22, 7/31/2021 (from table 2)
22, 8/1/2021 (from table 2)
22, 8/2/2021 (from table 2)
25, 8/1/2021 (from table 1)
25, 8/2/2021 (from table 2)
28, 8/2/2021 (from table 1)
28, 8/3/2021 (from table 2)
28, 8/4/2021 (from table 2)
28, 8/7/2021 (from table 2)
 
Ah, looks like you just need a UNION query.
 

Users who are viewing this thread

Back
Top Bottom