Creating a UNION Query in Microsoft Access - Combine multiple datasets into one view

  Рет қаралды 14,348

Too Long; Didn't Watch Tutorials

Too Long; Didn't Watch Tutorials

Күн бұрын

Пікірлер: 30
@K5MackMarchant
@K5MackMarchant 3 ай бұрын
Short and to the point, well done!
@TLDW_Tutorials
@TLDW_Tutorials 3 ай бұрын
Thanks so much! I really appreciate the comment and you checking out the video.
@DarmaSaputra-y8b
@DarmaSaputra-y8b Жыл бұрын
This is what I have been looking. Thank you!
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
No problem, I am glad it was helpful. Thanks for watching!
@RabiReels
@RabiReels Жыл бұрын
Thank You!. I have two Access tables. How do I merge these tables which have identical structures and then get only unique records in a new access table?
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
So just to be clear, so if you want to merge two tables with the same structure, you want to do a join. I have a video for how to do that. Based on your comment though, it sounds like you want to do a UNION query like in this video and then create a new table. In your UNION query, I would make a new field to denote D1 (or dataset1) + your row ID and D2 (or dataset2) + your row ID. This will guarantee each row will have a unique identifier. Once you get the UNION query to work with this, you can save it. Open a new query, use the UNION query you just made as your data source, and then generate a Table query (click on "Make Table" under Query Design). Once you run it, this should create a new table with the two tables you made in your union query. Here's the SQL example of this based on the fields and tables from the video: controlc.com/d8237a33
@Jojosmith342
@Jojosmith342 Жыл бұрын
thumbs up for another great tutorials. How to extract data from one table for the other table (different fields). I have table with hundreds of thoussands records. One table has all the names, the other table has thousands of missing names. Is there anyway to copy data from one table to the other? thanks a lot
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
Responded to the other message. Great question. Let me know if you still have any issues. Like I said, I may try to make a quick video about this for next week.
@threehanded8853
@threehanded8853 11 ай бұрын
My query does not like one of my first fields with spaces in it, and that column is not in the other tables I am selecting. Perhaps I should be doing a join instead since columns and rows/records are mostly different?
@TLDW_Tutorials
@TLDW_Tutorials 11 ай бұрын
Hey! So for your field with spaces in it, just surround the name with brackets and you should be good. As for the join versus the union, think if you want stacked (1, 2, 3 in one table and add 3, 4, 5 from another table). If you do and many of your fields align, a union should be fine. For the fields that are missing, you can make a placeholder for them. For a join you would typically want to merge if there is a bunch of different, distinct data you want to bring together. Like race in one table and gender in another, etc. I guess it just depends on your two datasets. Feel free to copy and paste your query here if it would help. I’d be happy to look.
@threehanded8853
@threehanded8853 11 ай бұрын
@@TLDW_Tutorials thank you! I fixed my copy paste and text errors in the sql editor, but now I realize in a union the number of fields must match, but that is not my scenario. I have 20x10 and 4x6, and so on, that need to come together in one matrix. Not sure of the best approach, or whether I should just “form” it in Excel!?
@TLDW_Tutorials
@TLDW_Tutorials 11 ай бұрын
@@threehanded8853 Sounds like a join may be a better fit. Do you have some kind of unique identifier you can merge the tables together on? Think like a social security number or something that's unique that can bring the tables together. Also for a union query, you can have uneven number of fields and just add the placeholder fields to make it match up, though it sounds like that's not what you want to do. I know it's complicated to work this out in the comments. Another thing you can try is adding a snippet of both datasets, sending it to ChatGPT and asking the best approach.
@threehanded8853
@threehanded8853 11 ай бұрын
@@TLDW_Tutorials thanks again. Yes, I will try the join as I have one unique field (sequential numbering) in all tables.
@thearter5480
@thearter5480 6 ай бұрын
Can I use the union query and then insert the results into a new table?
@TLDW_Tutorials
@TLDW_Tutorials 6 ай бұрын
Yep, absolutely. Create the union query and save it. Next, open a new query and add your union query as your data source. You should be able to append or create a new table with the results. What I mean is create a “create” query or “append” query. If you have any trouble, let me know and I can give you more detailed instructions.
@HarveyPVP
@HarveyPVP Жыл бұрын
I wasn't able to create the variable
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
Check every little character to make sure nothing got missed… if you want to paste your code into a controlc.com link and send it to me, I can take a look. You can also send it to ChatGPT or Bard and ask “why isn’t my code working?” Which might solve it.
@RomuVoice
@RomuVoice Жыл бұрын
I have 29 tables how i get all in one form plzzz help me
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
Wow. That’s a lot of tables! Is there some pattern to the names of the tables (example: table1, table2, etc)? And I assume that they have some of the same fields?
@RomuVoice
@RomuVoice Жыл бұрын
@@TLDW_Tutorials its actually my office 29 departments different data but now i. am stuck
@RomuVoice
@RomuVoice Жыл бұрын
@@TLDW_Tutorials is there any way ????
@TLDW_Tutorials
@TLDW_Tutorials Жыл бұрын
@@RomuVoice yep, there’s likely a way. If you can describe how to do it to another person, then you can make code to do it. So are the 29 tables the only tables you have on your database? Also you said different data, but does this mean nothing consistent between all 29 tables?
@RomuVoice
@RomuVoice Жыл бұрын
@@TLDW_Tutorials the id no numbers are marched but departments are diffrents
How To Create a Database in Microsoft Access
12:48
Computer Learning Zone
Рет қаралды 60 М.
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Ms Access Dynamic Menu
27:49
Sissoko M. Prodev
Рет қаралды 179 М.
1st, 2nd and 3rd Normal Form (Database Normalisation)
11:42
Learn Learn Scratch Tutorials
Рет қаралды 470 М.
How to Use Union Queries in MS Access
10:13
Sean MacKenzie Data Engineering
Рет қаралды 11 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 223 М.
UNION Queries in SQL and Access
31:06
codekabinett.com/en
Рет қаралды 4,9 М.