Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search. Sign up to join this community.
The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Update using select in DB2 Ask Question. Asked 3 years, 8 months ago. X AND Q2. Y AND Q2. Z AND Q2. W AND Q2. Now you have a bigger Q2 query. Do steps 3 and 4 again, this time replacing the Q2 after the FROM in your main select with the bigger Q2 query in your clipboard. Z I have done this in my own personal experience just now actually and it works perfectly.
Good luck. Bob Bob 1 1 1 bronze badge. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta.
Luka - please update your question with the revised requirement. Also, please note that the second example here will only be garuanteed to work if either the two columns will accept null s, or the selection from table2 will always return a row. Show 3 more comments.
Yes it is possible. Tested under DB2 Tim Seed Tim Seed 4, 2 2 gold badges 26 26 silver badges 25 25 bronze badges. Vlad Troyan Vlad Troyan 2 2 silver badges 4 4 bronze badges. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. The subquery allows you to form a search condition based on the data in another table. For example, you can find all books by publishers whose name contains the keyword Oxford :. A subquery is also known as an inner query or inner select while the query that contains the subquery is known as an outer query or outer select. To better understand the result of the outer query, you can imagine that Db2 goes through the following process:.
By using the subquery, you are able to combine steps together. The subquery removes the step of selecting the publisher id list and plugging them into the outer select.
0コメント