Skip to content
Advertisement

Tag: subquery

Multiple inserts of multi-valued subqueries

I found the single insert answer from this question: How can I insert values into a table, using a subquery with more than one result?. However, I’m looking for a way to do multiple inserts in this fashion. Single-Insert version WORKING! (using the previous answer…): Multi-Insert version (Failing) Is there a method of doing these multiple inserts of multi-column subqueries

get sum of all rows with id from main query

I need the sum of all positions from one year for every customer. In the subquery i’ve hardcoded the customernumber (mark 1) but it needs to be another customernumber for every row. The values in mark 2 are wrong. Thanks for your help! Answer If BAS_Customers and BAS_Contacts have a one-to-one relationship, then you should be able to use something

MySQL – Joins and Subqueries [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I’m looking a question that asks ‘List for each year the name of

How to select MAX from AVG?

I’m practicing for my SQL exam and I can’t figure out the following question: “Of the average amount paid per customer, show the highest amount.” So to retrieve the average amount paid, I would do the following: Then I would like to retrieve the highest average amount out of this list of averages. I thought the following would do the

Advertisement