union Questions

17

Solved

I've written a couple of complex queries (at least to me) with Ruby on Rail's query interface: watched_news_posts = Post.joins(:news => :watched).where(:watched => {:user_id => id}) watch...
Grubb asked 13/7, 2011 at 23:34

10

Solved

What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view ...
Huddle asked 14/10, 2008 at 12:51

5

Solved

This is a SQL design question. First, the setup. I have three tables: A, which is automatically populated based on a query against a linked server. The data in this table cannot be changed; B, wh...
Mullah asked 11/1, 2010 at 20:40

7

Solved

I have two selects: SELECT id FROM a -- returns 1,4,2,3 UNION SELECT id FROM b -- returns 2,1 I'm receiving correct num of rows, like: 1,4,2,3. But I want b table results first: 2,1,4,3 or 2,1,...
Tala asked 17/5, 2011 at 20:36

3

Solved

I have an issue with using Oracle's union and order by clauses together. I have two complex queries (with sub queries in them) having an order by clause for each of them. I need to union the outpu...
Appellate asked 18/4, 2014 at 15:0

6

Solved

I just read part of an optimization article and segfaulted on the following statement: When using SQL replace statements using OR with a UNION: select username from users where company = ‘bbc’ ...
Peroxidize asked 6/12, 2012 at 18:51

5

Solved

I have a stored procedure I need to call several different times passing in different paramaters each time. I would like to collect the results as a single dataset. Is something like this possible ...
Jake asked 13/3, 2011 at 20:16

7

Solved

I have a union of three tables (t1, t2, t3). Each rerun exactly the same number of records, first column is id, second amount: 1 10 2 20 3 20 1 30 2 30 3 10 1 20 2 40 3 50 Is there a simple way ...
Tad asked 5/3, 2010 at 15:16

1

Solved

In Python, Python has Union type, which is convenient when a method can accept multi types: from typing import Union def test(x: Union[str,int,float,]): print(x) if __name__ == '__main__': test...
Segno asked 8/3, 2022 at 8:24

14

Solved

I want to use order by with union in mysql query. I am fetching different types of record based on different criteria from a table based on distance for a search on my site. The first select query ...
Precedence asked 20/8, 2010 at 13:29

2

Solved

I'm running a search feature on three tables in my Phoenix app, and I want to join them using something like SQL's UNION operator. I have three tables: mix phx.gen.json Accounts User users handle...
Evansville asked 13/10, 2017 at 0:13

3

I have two sets of data, one of which is dynamically generated. If I leave off the column state it works perfectly as that column doesn't really exist, my question is how can I ignore a column for...
Mathis asked 18/4, 2018 at 13:26

5

I have two tables. Differ in that an archive is a table and the other holds the current record. These are the tables recording sales in the company. In both we have among other fields: id, name, pr...
Commemoration asked 24/10, 2011 at 14:18

3

I'm trying to implement toJson/fromJson for a union generated by the freezed package. Let's say we have a class as following: @freezed abstract class Result with _$Result { const factory Result.e...
Mucky asked 17/6, 2020 at 20:27

1

from django.contrib.postgres.aggregates import ArrayAgg t1= Table1.objects.values('id') t2= Table2.objects.values('id') t3= Table3.objects.values('id') t = t1.union(t2, t3) t.aggregate(id1=Array...
Ransdell asked 26/7, 2019 at 8:51

3

Solved

I have a small query, and a union to put another small query next to it. However, the union has a syntax error in it. Select <column1> ,<column2> ,<column3> From <Table1> ...
Charest asked 3/6, 2014 at 16:17

3

Solved

I have a SQL Server stored procedure that doesn't give me all the results when I add in the union and the second half. The first half will give me all 6 results, using the union, I only get 5. Th...
Baur asked 2/9, 2011 at 18:49

3

Solved

I have a discriminated union, for example: type Union = { a: "foo", b: string, c: number } | {a: "bar", b: boolean } I need to derive a type that includes all potential propert...
Dysart asked 16/1, 2021 at 14:19

12

Is it possible to order when the data is come from many select and union it together? Such as Select id,name,age From Student Where age < 15 Union Select id,name,age From Student Where Name like...
Pelorus asked 17/1, 2011 at 17:9

1

Solved

I am trying to union two results with each other the sql-query I could use for would look like this: SELECT id, created_at, updated_at, deleted_at, user_id, friend_id FROM public.friendlists where...
Yucca asked 12/9, 2021 at 20:4

3

Solved

I'm trying to selecting multiple dynamic range. Trying to use the union method and I'm getting Method 'Range' of 'object' Global Failed error on first Set line. Dim LR As Long LR = Range("A60000")...
Hidrosis asked 6/2, 2014 at 23:40

3

I want to Union multiple datasets in Palantir Foundry, the name of the datasets are dynamic so I would not be able to give the dataset names in transform_df() statically. Is there a way I can dynam...

4

Solved

Need to show the following columns (3) using UNION to return: All customers who do not have an invoice All products that were not sold Category: Is this related to "customer" or "...
Compline asked 10/7, 2020 at 23:40

2

Solved

Given the following types, interfaces, and getData function below I'm trying to find a way to leverage discriminated unions so that the TS compiler can narrow the return type of getData(source: DOS...
Modern asked 28/7, 2021 at 0:34

5

Solved

Here is my query (SELECT * FROM `jokes` WHERE `flags` < 5 AND (`title` LIKE "%only three doors%" OR `joke` LIKE "%only three doors%") ORDER BY `ups` DESC,`downs` ASC) UNION (SELECT * FROM `jok...
Lactic asked 30/12, 2011 at 23:52

© 2022 - 2025 — McMap. All rights reserved.