Тёмный

14. Subqueries (Programming In Microsoft Access 2013) 🎓 

Programming Made EZ
Подписаться 79 тыс.
Просмотров 115 тыс.
50% 1

A newer version of this series has started for Microsoft Access 2016 here:
• Microsoft Access 2016 ...
----------
Subqueries in "Programming in Microsoft Access 2013". Hosted by Steve Bishop.
In this free beginner video tutorial series Steve will be going over Database Development in Access, creating the User Interface, and coding the backend of the application in Visual Basic for Applications (VBA).
Click here for the full playlist of "Programming in Access 2013":
• Programming in Microso...
Click here for the Work Files of this series:
github.com/Xip...
----------
Become a member today for only $5 a month!
/ @programmingmadeez
When you join, here’s what you’ll get:
Your name in the credits
A form to ask me for help on your project
10% off in the Teespring store (discount code)
----------
Looking for DAILY news and commentary? Join us on my other channel “Coffee With Steve” for daily videos where we discuss Technology, Software Development, Politics, Culture, and many other things.
Coffee With Steve: / @coffeewithsteve

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 40   
@ProgrammingMadeEZ
@ProgrammingMadeEZ 5 лет назад
Looking for DAILY news and commentary? Join us on my other channel “Coffee With Steve” for daily videos where we discuss Technology, Software Development, Politics, Culture, and many other things. Coffee With Steve: ru-vid.com/show-UCeXAUvo5xxDY_b-lSknPC1A
@matthewbrereton4629
@matthewbrereton4629 3 года назад
Steve. I am so very grateful for the highly informative and candid (warts and all ;) ) approach. I have learned a great deal so far and looking forward to learning a great deal more. Thanks
@Seatb3lt
@Seatb3lt 7 лет назад
Your videos are very concise. It's difficult to keep maintain my attention and you do a great job! I enjoy learning from you Steve Bishop. Have a like.
@bigbubba6293
@bigbubba6293 6 лет назад
Great job. I learn at least one nugget of information every time. Well worth watching!
@mitchellfolbe8729
@mitchellfolbe8729 3 года назад
Good one. I find the builder helpful when you are doing concatenations.
@fredashe3013
@fredashe3013 6 лет назад
Excellent description. That solves a problem I have been having with my db of displaying entries that have null values. Thank you
@TheChrillexx
@TheChrillexx 9 лет назад
First of all thank you for this awesome series. Not only ne of the best Access Tutorials, it just is one of the best Tutorials I have ever seen! But iI have a Question.. Well i was just typing my Question here and noticed that its to hard to describe haha. Ill watch alle your videos and see if I can find the answer! Thank you
@chrisrjcox
@chrisrjcox 3 года назад
Can you explain why you wouldn't just change the join to show all addresses the only associated address types? I don't see why we would us a subquery?
@khabathasan1750
@khabathasan1750 4 года назад
Thanks a lot for the whole series 👍.
@TheBlackWallet
@TheBlackWallet 5 лет назад
Great tutorial. Thx !
@elfo2285
@elfo2285 9 лет назад
Hi Steve! You are a master. You solved my problem with the subquery stuff! It is the one I had! However, I have a question for you. So, I start to get used more and more to Access thanks to your tutorials, and more info that I can find on the web. I am building a subquery, but the info does not look I want. Here is my problem: Let's say I have a table with "References" and another one with "Authors". One reference has many authors and one author can appear in many references. So it is a many-to-many relationship. I build it with a third table that links the two or use lookup wizard with "allow several entry". Let's say I use the first method: I build a junction table that makes the like between references and authors. From that I can create a query (actually a subquery that will be used for something else) that links the references with authors. Building the query, it will appear something like that: ReferenceID Title Authors 1 Book1 Joe Dante 1 Book1 Jane Schmoe 1 Book1 Godzilla 2 Book2 Joe Dante 2 Book2 Monika Lebobsky ... Actually, for each book, the query will add a record for every author. My question is the following: is there a solution to "sum up" or "concatenate" (I do not know what is the correct thing to say), in order to have 1 line for each book with multiple values for authors separated by a coma? For example something like that? ReferenceID Title Authors 1 Book1 Joe Dante, Jane Schmoe, Godzilla 2 Book2 Joe Dante, Monika Lebobsky That would be awesome to do! And I would be very thankful to you if you can help me! I need to build that in order to use it as subquery to add information (mechanical tests, etc.) Do you know please how to do or do you know where I can find the information? Cheers!
@ProgrammingMadeEZ
@ProgrammingMadeEZ 9 лет назад
+elfo2285 It can be done, but it's a very complex query. I would recommend you use VBA to build a table with the values instead.
@njemilesiwatu4148
@njemilesiwatu4148 9 лет назад
You probably cover this in a later video. How do you create a query pulling the telephone information that will still show the customers even if they do not have a telephone number? given that the relationship is between the qrycustomer and Joining table? I Joined the address, phone number, phone type and the customer_phone which gave me the customers that had numbers. How do I show the all the customers, even those without numbers?
@ProgrammingMadeEZ
@ProgrammingMadeEZ 9 лет назад
I do cover this in later videos.
@attilajager6508
@attilajager6508 5 лет назад
Hi Steve! Could you please advise, in which episode may I find the answer to the question above? Thank you in advance...
@filipkotanski7911
@filipkotanski7911 7 лет назад
May I know how you select multiple columns from a table or a query and then drag them to new query design pane or whatever that bottom part of the window is design view?
@aliakhter11
@aliakhter11 7 лет назад
Hi, At 3:00 when you added the new table and ran the query, I am getting a message "type mismatch in expression". I also selected option 1 for join properties. How can I fix this issue?
@85firebirdgirl
@85firebirdgirl 6 лет назад
I am getting the same issue.
@GuitarMom146
@GuitarMom146 9 лет назад
Hi, thanks for the great series. I am an experienced Access developer, but with a much older version of Access (don't ask...). I am in the habit of usually creating "double joins" in queries -- ie table 1 joined to table 2 joined to table 3 instead of saving and joining subqueries. is there an advantage (performance or otherwise) to defaulting to the subquery technique instead? Thanks!
@ProgrammingMadeEZ
@ProgrammingMadeEZ 9 лет назад
Alyssa Siegel Great question and one that is a bit more technical than most people would be interested in at this level. That being said, I do prefer doing subqueries because the result sets will be smaller if there is any filtering on them. If you have a WHERE or HAVING clause and returning fewer columns in your subquery, then you have less data for the engine to process through when it does the second join. The narrower you can make the data that has to be processed, the faster your queries will perform.
@GuitarMom146
@GuitarMom146 9 лет назад
thanks. I've done it both ways depending on the situation, but my usual habit is not to go with the subqueries unless needed. Believe it or not, I've been programming in Access 2.0 for over 20 years. Overhead of my small business and need to maintain for current customers have prevented me from ever being able to get off of that platform (although i've tried a few times). I'm watching your tutorials to see what access has evolved to since then. Thanks for the series, and for your thoughts.
@ProgrammingMadeEZ
@ProgrammingMadeEZ 9 лет назад
Alyssa Siegel No problem. As one last thought on this, I tend to shy away from SAVED queries altogether. I usually write up all of my queries in VBA. Not only that, I make my subqueries embedded within the usual query and alias the subqueries... For example: SELECT SQ1.Field1, SQ2.Field3 FROM (SELECT Field1, Field2 FROM SomeTable WHERE Field1 = 'value') AS SQ1 INNER JOIN (SELECT Field3, Field4 FROM SomeOtherTable WHERE Field3 = 'value') AS SQ2 ON SQ1.Field2 = SQ2.Field4 This actually has 3 total queries in it with 2 subqueries that filter the data down to just the relevant data, then do a top level query on the results of those 2 subqueries. This tends to be the fastest way of performing queries that involve complex data sets.
@astronaut77
@astronaut77 2 года назад
I can't see any "SQL Query" here! Only wizard query!!
@lionintu
@lionintu 6 лет назад
It looks like 'll have to change the form Recordset Type to Dynaset (Inconsistent Updates) when utilitizing Subqueries in a Query in order to EDIT Data in the query, .... I go online and see some people say it may be an issue when updating info. Should I be concerned ? I do I just test adding records to see if the updating works? I'd hate to create a database that could eventually crash and fail.
@hamdyel-shahat2234
@hamdyel-shahat2234 8 лет назад
Thanks for this great series I finished it and restart, I have a question please and I want the answer to be simple and in-depth because I'm not an English native speaker. why did you use sub query?because I can make this idea without sub query using left and right join like this SELECT cus.cusName, cusAddresses.addressType_ID, cusAddresses.city FROM tblAddressType RIGHT JOIN (cus LEFT JOIN cusAddresses ON cus.ID = cusAddresses.cus_ID) ON tblAddressType.ID = cusAddresses.addressType_ID;
@ProgrammingMadeEZ
@ProgrammingMadeEZ 8 лет назад
+Hamdy El-Shahat I used a subquery because the purpose of the video was to demonstrate how subqueries work.
@IsabellaJosephina
@IsabellaJosephina 9 лет назад
Hi Steve. When I run this query or the sub-query, it's only showing the first Metro Properties (not all three companies). Any idea what I may have done wrong to cause that? I'll keep watching and maybe figure it out. Thanks.
@IsabellaJosephina
@IsabellaJosephina 9 лет назад
+Joe Adiutori - I figured it out. In the tbl1Addresses I had "0" for AddressType_ID. I put a "1" in there and now it works.
@stevenneuberger4323
@stevenneuberger4323 8 лет назад
When you use a query in another query like was done in this segment it would be great if there were something we could call it but I don't think it's a good idea to call it a subquery. According to msdn.microsoft.com/en-us/library/office/aa217680(v=office.11).aspx A subquery is an SQL SELECT statement that's nested inside of another SQL statement." That's something entirely different from just using a query in another query.
@ProgrammingMadeEZ
@ProgrammingMadeEZ 8 лет назад
+Steven Neuberger Though I understand your perspective, it is entirely common and correct to call a referenced query a sub-query. When you create the query as you suggest, you must still alias the subquery and it is processed by the engine as a separate query. Access makes this somewhat easier by allowing you to contain that subquery within an Access object called a QueryDef. That QueryDef has a name or alias if you will that the original query must get the results from in order to continue processing. So as it turns out, it is truly a distinction without a difference.
@michaelbattle6852
@michaelbattle6852 7 лет назад
Is there a way to create a query to with totals to show all records including the ones with a zero value?
@ProgrammingMadeEZ
@ProgrammingMadeEZ 7 лет назад
Just use the Count function on a column in an aggregate query. I cover aggregate queries later in the series.
@jonathanroberts3864
@jonathanroberts3864 7 лет назад
Hi Sorry, stupid question probably but I am going to ask it anyway (be gentle with me I am new to all this). What turned the qryEmployeeAddresses from being a query into a subquery?
@jonathanroberts3864
@jonathanroberts3864 7 лет назад
..........sorry *qryCustomerAddresses
@ProgrammingMadeEZ
@ProgrammingMadeEZ 7 лет назад
There really was no "change" of a query into a subquery. A subquery is just merely the use of a query inside of another query.
@jonathanroberts3864
@jonathanroberts3864 7 лет назад
Programming thankyou
@njemilesiwatu4148
@njemilesiwatu4148 9 лет назад
Also,, I am unable to add entries in the query or the form when I run the phone query
@ProgrammingMadeEZ
@ProgrammingMadeEZ 9 лет назад
Multiple joins will cause problems trying to add data. I recommend if you're going to add records you do it to the tables themselves and not through a query.
@njemilesiwatu4148
@njemilesiwatu4148 9 лет назад
aha. thanks
Далее