union

how to use group by with union in t-sql

hi all, how can i using group by with union in t-sql? i want to group by the first column of a result of union, i wrote the following sql but it doesn't work. i just don't know how to reference the specified column (in this case is 1) of the union result. great thanks. SELECT * FROM ( SELECT a.id , a.time ...

MySQL: Usage of indices in UNION subselects

In MySQL 5.0.75-0ubuntu10.2 I've got a fixed table layout like that: Table parent with an id Table parent2 with an id Table children1 with a parentId CREATE TABLE `Parent` ( `id` int(11) NOT NULL auto_increment, `name` varchar(200) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB CREATE TABLE `Parent2` ( `id` int(11) NOT NUL...

Advanced indexing involving OR-ed conditions (pgsql)

I'm starting to get a much better grasp on PostgreSQL indexing, but I've run into an issue with the OR conditional, where I don't know how to go about optimizing my indexes for a faster query. I have 6 conditionals that, when run individually, appear to have a small cost. Here's an example of the trimmed queries, including query plan c...

SQL join optimalization (get rid of UNION)

Hi, 1st disclaimers: I'm not a programmer, never was had never been taught "higher" math despite the upper statements sometimes I have to work with SQL. Now I need to create a view from a select of my colleagues (who had used four unions looked like he do not know how to use or in the where part...), and now I'm here. Is there a si...

.Net class generation from XSD with union

I've been working to create classes representing the HR-Xml 3 spec for the stand-along packages related to Screening. I've had a couple of problems, but currently I believe the main problem is the lack of support within xsd.exe for the xsd:union statement. When Xsd.exe encounters a simple type defined by union, it ignores the d...

Getting Union, Intersection, or Difference of Sets in C++

I have a couple questions about how to use C++ sets (std::set) Is there a way to get the union, intersection, or difference of two C++ sets? (It's pretty easy to write my own functionto do that but I wanted to know if there was a built in function for it) Can C++ sets be used as keys in a map? ...

Merge/Join 2 jQuery sets

Look at this code for example $div = $('#my div'); $ul = $('#somewhere ul'); How can I perform a jQuery method on both of them? For example, would this work? What is best practice here? $($div, $ul).addClass('my-new-class'); Wouldn't that search $div under a context of $ul ? Thank you ...

Why does my object take up 64 bytes and not 32?

I have a class that goes like this: class myType { union { float data[4]; other_vector4_type v } ; typedef union { float data[4]; other_vector4_type v } myType-internal_t; <various member functions, operator overloads> } Now I want to use this type in my vertex buffer, but the sizeof() isn't as expe...

problem with quadTree & union

hi! i have the following quadtree-like structure, in which each cell can either be a inner node or a leaf. if it is a leaf, it can store a color. if it is a inner node, it stores pointers to four children (which can be either leaf or inner node): class RenderBucketCell{ public: RenderBucketCell(); RenderBucketCell(float R, floa...

Good way to combine two List<T>s in .NET 2.0?

I have two lists I need to form the union of, but I'm in .NET 2.0 so the Union() method appears to be out. These are lists of integers, so no problem with the equality comparisons. What's a good way to go about this? ...

what does union U look like in the memory?

enum Enums { k1, k2, k3, k4 }; union MYUnion { struct U{ char P; }u; struct U0 { char state; } u0; struct U1 { Enums e; char c; int v1; } u1; struct U2 { Enums e; char c; int v1; int v2; } u2; struct U3 { ...

Questions about vector, union, and pointers in c++

The question I have are NOT homework questions, but I am considering using these concepts in my assignment. The content,if it helps, is like this: I need to keep track of several union instances and they belong to my own union in one of my own class as class variables. (Note: the number of union instance is unknown, so I cannot just have...

How to dynamically create a union instance in c++?

I need to have several instances of a union as class variables, so how can I create a union instance in the heap? thank you ...

A question about union in C

I was reading about union in C from K&R, as far as I understood, a single variable in union can hold any one of the several types and if something is stored as one type and extracted as another the result is purely implementation defined. Now please check this code snippet: #include<stdio.h> int main(void){ union a{ int i; char c...

union versus void pointer

What would be the differences between using simply a void* as opposed to a union? Example: struct my_struct { short datatype; void *data; } struct my_struct { short datatype; union { char* c; int* i; long* l; }; }; Both of those can be used to accomplish the exact same thing, is it better t...

Randomly choose an instance from union in F#

In F#, given type MyType = A | B | C | D | E | F | G How do I randomly define an instance of MyType? ...

Is there a UNION equivalent to FULL OUTER JOIN in T-SQL that will union dissimilar column sets?

I am trying to accomplish the following: SELECT col1, col2 FROM table1 UNION SELECT col2, col3 FROM table2 With the result: col1, col2, col3 1 , 1 , NULL NULL, 1 , 1 The union of the columns and the rows is returned. You could think of it as the UNION equivalent of a FULL OUTER JOIN. The simple answer to this question is: S...

SQL Size comparison

I have a database where I check on the size, because clients may only use a certain amount of space, aswell as they may only have a certain number of 'pages', which I put in the db aswell. I have the following sql query: SELECT table_schema "Servers", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_fre...

Strange Behaviour Class Objects Inside Union.

Hi I wanted know the reasons of the following code void main() { class test { public: test(){} int k; }; class test1 { public: test1(){} int k; }; union Test { test t1; test1 t2; }; } For the Above code it gives error "error C2620: union 'Test' : member 't1' has user-defin...

union members may not have constructors, but `std::pair` okay?

union members may not have destructors or constructors. So I can't template the following class Foo on my own MyClass if MyClass has a constructor: template<class T> struct Foo { T val; Foo(T val_) : val(val_) {} size_t hash() const { union {T f; size_t s;} u = { val }; return u.s; } }; struct MyClass { bool a; doubl...