Questions tagged [union]

Use this tag only for questions about UNION, a keyword of the SQL language for combining the results of multiple SQL queries. Use [union-all] for the UNION-ALL keyword. Use the tag [unions] for unions in C, C++, and similar languages.

Filter by
Sorted by
Tagged with
0 votes
1 answer
49 views

Sets in list self-unite for some reason

I'm trying to program the Kruskal algorithm for minimal weight tree in Python, where the weighted edges are represented as a list of tuples ({i,j},w), where {i,j} is the edge, and w is the weight. But ...
Wei Le Hu Tang's user avatar
0 votes
0 answers
7 views

Sql Anywhere : Find difference between two tables with same columns

I have two tables with large number of columns, but same columns in both tables. Is there an easy way to find difference between two tables in Sql Anywhere (without joins if possible, as number of ...
Kaustubh Pandey's user avatar
0 votes
1 answer
18 views

applying count() across multiple columns in a table referencing the same foreign key

I'm trying to get group counts for music genres on weekly top songs list, where the table for the billboard top songs has multiple foreign keys all to the song's primary key song_id. E.g.: over the ...
go4ino's user avatar
  • 7
0 votes
2 answers
100 views

SQL 43 tables into 1 table

just started exploaring the world of data analysis. I have a dataset with 43 tables, all tables have same primary key. How can i create 1 table out of the 43 that i have? Are joins the only way to do ...
Roman Fridman's user avatar
0 votes
0 answers
19 views

Issue with merging polygons in R - Heavy Geojson file

I have a pretty heavy geojson file extracted from coral allen atlas. This file is composef of a multitude of polygons with an assign class. I am currently facing an issue while merging polygons of the ...
seb33's user avatar
  • 1
0 votes
0 answers
60 views

Is it possible to use cppcheck to check if a union has been initialized?

Recently I found a mistake in my code. it's about an union type local variable has not been initialized, so that there will be unexpected data in the memory. I'm curious if there is a way to use ...
Risusdan's user avatar
0 votes
1 answer
34 views

Union with two collections is not outputting expected result

I am usign mongo version as v5.0.19 I have 2 collections with the data in it as below: Collection 1 - external_S_P_FLAT_main_api: [ { "_id": { "$oid": "...
Hemant Joshi's user avatar
-1 votes
0 answers
13 views

views combining from mutiple table

The code provided in the image needs help in converting that in a single view, It has 3 views created need to change that into a single table. Tried adding union all but that did not help. the data is ...
Aishwarya Maganti's user avatar
0 votes
2 answers
82 views

Cartesian multiplication of two sets where the member of each set is a set

enter link description hereI have two expressions that I want to get a member-by-member union of. But the problem is where the member of each expression is a set. I have a graph from which I obtained ...
Mohammad Omidi's user avatar
-1 votes
1 answer
58 views

UNION query for every raw in a table

Version of mariaDB I have a table: USER Animal 1 1 3 1 4 1 5 1 1 2 3 2 4 2 5 2 2 1 5 7 2 2 5 8 2 9 5 9 4 10 5 10 I want to count UNION set for user1 with every other user. For ...
Михаил Зуев's user avatar
0 votes
1 answer
27 views

Using UNION in MySQL is not properly combining the rows

I have a patients table (kid) and 2 tables to track both their height and weight in medical routine controls (track_height, track_weight). there may be more than 1 measurement per type (height and ...
Andres SK's user avatar
  • 10.8k
0 votes
0 answers
10 views

How to serialize structs containing unions using the Cereal C++11 library?

How does the Cereal C++11 library handle unions within structs? For example: enum class Tag { eInt, eFloat }; struct myStruct { Tag tag; union { int i; float f; } val; ...
Dominic Sesto's user avatar
-1 votes
2 answers
80 views

Combine multiple calcs using union

I have multiple calculations that use union and i am trying to combine them so i can load them into a new table on the same row. Below is an example of the calculations, i will have 8 in total. I want ...
Blowers's user avatar
  • 75
0 votes
0 answers
36 views

How to use union type in typscript? [duplicate]

interface A { name : string; age : number; } interface B { name: string; address: string; } public samplefunction(data : A | B) : A | B{ switch(data.name) case("John"): ...
Hyeonjae's user avatar
0 votes
2 answers
53 views

SQL Server : select rows with time stamp values near values in subquery

I have a log table that includes id, TimeStamp, Message where the Message value sometimes contains 'WARNING'. SELECT TimeStamp FROM Logs WHERE Message LIKE '%WARNING%' What I need are the rows that ...
Hey Mikey's user avatar
  • 101
1 vote
0 answers
104 views

C++ 14 - union - Is it legal to access inactive member?

After read a lot about it, I'm confused about if it is legal or not accessing to inactive member of an union starting from C++14. I understood it is undefined behaviour up to C++11. Some references: ...
Manuel Tonella's user avatar
0 votes
0 answers
68 views

Create a sheet that unify other sheets

I have a file with several sheets, they're all the same but contain data from different sources. I would like to create a new sheet that updates automatically and give me the total of all the other ...
Davidator's user avatar
0 votes
1 answer
58 views

Select distinct record from union query [duplicate]

I have multiple tables with OS_Data from different application databases and scan engines, which I've given the data a priority based on the clarity of the data. I want to get a list of unique ...
Phelzier's user avatar
0 votes
0 answers
21 views

pyspark/Synapse/python -- Dataframe union is running slow

I have a union of six dataframes each having almost 200 columns. The sum of all the records in all 6 dataframes is 90,000 records. The union is taking more than 15 minutes to complete. I have tried ...
Wasim Syed's user avatar
-2 votes
2 answers
64 views

In oracle apex, when I modify the data in interactive grid which has a union query, it gives me ORA-02014 error. How to handle this error?

When I try to modify the interactive grid column it gives ORA-02014 error. In back-end i have used sql query with union in it and also used join to join 3 tables. I tried in the last couple of days ...
Shuvasish Dolui's user avatar
1 vote
1 answer
124 views

Manipulating float bits using unions: Finding the correct uint type that fits the float

In C, I’ve seen this code used as a way to manipulate a float, down to the bits: union { uint32_t bits; float value; } By defining a variable of this type, one can perform bitwise operations ...
Hermit's user avatar
  • 101
2 votes
1 answer
38 views

Order by Nulls alphabetically then Not Nulls

I have a dataset where I'm trying to sort by having null startdate values first, then by lastname. Then nonnull startdates, also by last name: declare @t table (lastname varchar(100), firstname ...
jackstraw22's user avatar
2 votes
1 answer
62 views

Are _Atomic members of unions a good idea?

I'm using _Atomic integers inside of unions, such as: union dedup_option_seq { struct { uint32_t seq :18; // enough bits for seq uint32_t not_empty :1; // inverted ...
fadedbee's user avatar
  • 43.1k
0 votes
1 answer
30 views

Typescript - the type of property that depends on another optional property

I have a component in React const Faq = ({ shortVersion, data }: FaqProps) => { } With defined types type FaqProps = | { shortVersion: true; data: ShortFaqData[]; } | { ...
Blackbetty's user avatar
1 vote
1 answer
38 views

How to UNION product_groups and specifications of different hierachy level to deepest one?

Scenario - All valid classes / product groups and their valid specifications for all products in them are to be determined. Products have different specifications / features Products always hang on ...
HedgeHog's user avatar
  • 22.9k
1 vote
1 answer
147 views

How to create a SQL item history stockcard in the MS ACCESS database in VB.NET

I'm trying to create a SQL item history stockcard using an MS Access database in VB.NET. I have the SQL below, but it's not right yet: SELECT CodeProduct, Sum(IIf(Cat="IN", Qty, 0)) AS [IN], ...
siwa86's user avatar
  • 357
2 votes
2 answers
85 views

Defining and accessing members of unions and structs

I've got three possible definitions, but I'm confused why there are so many. Does accessing the members behave any different than one over the other? What are the pros and cons? Just wondering if ...
Natural Number Guy's user avatar
0 votes
1 answer
105 views

C++ casting int into enum then read that enum as bit field safe or not?

#include <iostream> #include <stdio.h> #include <string> #include <cstring> using namespace std; enum class OrderFlags : uint16_t { None = 0, BuySide = 1, UpdateVolume = ...
Huy Le's user avatar
  • 1,559
0 votes
1 answer
86 views

How to write copy/move constructors with delegated constructors and conditional initialiser lists

I'm close to finishing my container but my last problem to solve is how to handle the copy/move constructor and appropriately construct the correct member variable inside the private union member ...
DWil's user avatar
  • 33
-1 votes
1 answer
28 views

how do I make a table to display ratio between male and female by decade from different tables sqlite3

I'd like to display the ratio between SEX by decade how male and female compare to each decade adding table 1 and 2 together It should look like this: Year Sum of male Sum of female 2000 ### #### ...
rhoops's user avatar
  • 1
1 vote
2 answers
51 views

Why does UNION return less rows than one of its subrequests with MySQL?

UNION can be used to merge the rows of two sub-requests: SELECT column_name FROM table1 UNION SELECT column_name FROM table2; By default, MySQL's UNION is actually UNION DISTINCT, which means that ...
philippe_b's user avatar
  • 39.4k
1 vote
2 answers
83 views

C union result unexpected

This code doesn't return as i expect, identifier should be 0xABC is it possible to fix this? #include <stdio.h> #include "stdint.h" typedef struct { union { struct { ...
John's user avatar
  • 766
0 votes
1 answer
30 views

union and order by not working in sqlite3

I'm trying to union two tables with same exact column names but no shared columns and then pick the top 10 results. However, the results aren't reflecting the top 10 results. I've tried this Select a,...
rhoops's user avatar
  • 1
2 votes
0 answers
87 views

How to pass a byte array to union that has multiple structs in CGO

I'm using a byte array (from golang) to pass values to a union (in c++) which has multiple structs but I couldn't find out how to do it correctly. The value I set is getting assigned to all the ...
Binoj's user avatar
  • 37
2 votes
1 answer
52 views

Julia DataFrame Row data type has been changed?

I am not sure since when but actually DataFrame 'Row' data type has changed. ■previous Row │ id name sex age ave │ │ Int32 String String Int32 Float64 ...
onoke's user avatar
  • 99
-1 votes
1 answer
37 views

Is this a bug of the typescript compiler? Higher-order function using union types

function toNumber(input: 'a' | 'b'): number { switch (input) { case 'a': return 1; case 'b': return 2; } } function bar(toNumber: (input: 'a' | 'b' | 'c') => number): ...
mauroc8's user avatar
  • 455
1 vote
0 answers
24 views

Way of typing an object to be two+ variations without using a discriminated union special field in TypeScript? [duplicate]

I run into this situation a lot, and have just run into it, getting this error: Property 'id' does not exist on type 'Filter'. Property 'id' does not exist on type '{ slug: string; language: { slug: ...
Lance's user avatar
  • 76k
0 votes
1 answer
75 views

List of Union only accepts first type of union with Pydantic

With the following python type definitions: import pydantic from typing import List, Union import sys import pprint class TypeA(pydantic.BaseModel): name:str = "Type A" ...
Mr. Developerdude's user avatar
0 votes
2 answers
47 views

Get sum of a column from three tables and know which table it came from

I have an odd question. I have three tables all with different information but a few common columns. I want to get a sum from the tables, but I also want to know which table the data came from. I can ...
user2843577's user avatar
2 votes
1 answer
80 views

Ruby #union on Array reacts very strangely

I like to use the Array#union or #| method to return an array of objects where duplicates are removed. I have a custom implementation of eql? on my class. There is a really strange behaviour if I do ...
Lars Schirrmeister's user avatar
0 votes
0 answers
30 views

How can I union Polygon in c#?

I'm facing an issue I have a List<Feature> with geojson Polygon in each feature. I want to union each Polygon, how can I do it ? I use this function to read my filename static void Main(string[] ...
user10863293's user avatar
-1 votes
1 answer
24 views

Does Full Outer Join in MySQL return rows that both have nulls and match on either side (using Union All in mysql)

Ususal Full Join: SELECT empno, ename, dname FROM emps FULL OUTER JOIN depts ON emps.deptno = depts.deptno; Now since UNION ALL and UNION is an implementation of FULL JOIN in MySQL, which is the ...
Abhishek Gupta's user avatar
0 votes
0 answers
42 views

Merging multiple querysets using union is showing error with Count in annotate

I have a simple Django app and I am trying to merge multiple querysets using union but one of my queryset contains annotate with Count. I mean it is showing each UNION query must have the same number ...
Xerali's user avatar
  • 21
0 votes
0 answers
10 views

How to check if a value exists in first or second table?

I have two tables and both tables have a field with the same name (mobile). I want to make sure that neither table contains the value. I want to know how many rows the phone has in either table. my ...
rcweb's user avatar
  • 65
0 votes
1 answer
45 views

SQL UNION on different column lengths and data types

I have two tables CREATE TABLE LOGIN ( [ID] INT NOT NULL IDENTITY(1,), PASSWORD VARCHAR(30) NOT NULL, CONSTRAINT [PK] PRIMARY KEY ([ID] ASC) ) CREATE TABLE HASH ( PSWDHASH VAR(100) ...
corkeygo's user avatar
0 votes
0 answers
45 views

Excel VBA - ordering columns into range

I have a multi-sheet workbook I'm looping through to pull out key data ranges into an array. A couple of the sheets don't follow the standard format and so instead of simply grabbing Range("D6:...
DonnaR's user avatar
  • 1
0 votes
0 answers
25 views

Postgres- merge 2 different query results

I have 3 tables table1,table2,maintable: table1 tb1col1 tb1col2 maintable_id abc John 123 dof Mat 123 cda Mary 123 xyz Max 687 table2 tb2col1 tb2col2 maintable_id A 2.0 123 B 5.0 123 C 11.0 ...
Jo ABC's user avatar
  • 1
0 votes
1 answer
62 views

KDB/q How to use Union Join (notation question)

I've been trying to union join these two tables for about an hour now and am seceding to StackOverflow to help me. I have one table that looks like this: FIRST_TABLE: Name Start Time End Time Items ...
mmv456's user avatar
  • 25
1 vote
1 answer
32 views

Type inference with a Union types when accessing object by key/square brackets

I have a union type that is set in an object array type where I am dynamically looping after and using. When I set the object as a variable, check with an if case its type and then access it, the type ...
yusuf's user avatar
  • 11
-1 votes
1 answer
52 views

Combination of SQL Select statements

I am trying to take a "snapshot" of a state of some tables of our database. I have finished a few of them and I am currently working on the last, however for the last one I need to query two ...
wildercameron25's user avatar

1
2 3 4 5
106