Skip to content
Advertisement

Tag: union-all

UNION ALL Slower than N queries

This question is following this question where I wanted to select the MAX value of multiples fields while retrieving each row. The accepted answer with UNION ALL worked like a charm but I now have some scaling issues. To give some context, I have more than 3 million rows in my matches table and the filters used in the WHERE

how to sum two columns from different tables MySQL

I need to sum the data from two different columns located in different tables and grouped by session_id….. I need to sum the column of spent_points + price_points grouped by session_id this is the result i hope to get I have tried with this query but I have only managed to group the data but I have not been able

pgsql merge two json arrays

I have to select two type of result set from a table and merge them in single json array like Its saying syntax error I believe due to order by. I need to return this in json array so I am trying like this Its retiring two json arrays i.e. obvious, How can I make this in single array Thanks,

SQL union grouped by rows

Assume I have a table like this: col1 col2 col3 col4 commonrow one two null commonrow null null three How to produce a result to look like this: col1 col2 col3 col4 commonrow one two three Thanks Answer like this, you can group by col1 and get the maximum in each group:

union all two table instead of join

I have several table which I can not join them as it gets really complicated and bigquery is not able to process it. So I am trying to union all tables and then group by. I have an issue during this process. I have two tables called t1 and t2 with below headers, they don’t have null values: so in

Select list as column in Oracle SQL

I would like to append a few rows to an already existing table (15 rows to be precise). What is the quickest way to do this? This works, but it seems redundant. I was wondering if there’s a solution along the lines of: Please note that I want to preserve the leading zeros for each element in my list. This

UNION ALL not combining rows

I have this table called “valores_indices” where it imports stocks values every 1 hour, I need to get the values from each monitored stock at 8am and 6pm, those being respectively my “vlrAberto” and “vlrFechado” selects I don’t get why these are not merging, I’ve done it before, any help would be appreciated since I’m running out of ideas, I’ve

Advertisement