union

mysql short union

I'm far from being a mysql guru, so need to know if there's a way to make this query faster,shorter and more compact. (SELECT DISTINCT(cfrm.nid), f.filename, n.title, n.created FROM content_field_raamatu_marksonad cfrm LEFT JOIN node n ON (n.nid = cfrm.nid) LEFT JOIN content_field_kaanepilt cfk ON (cfk.nid = n.nid) LEFT JOIN ...

Help casting a pointer to a union

I am working on C firmware project. I have a union that is defined as, typedef union { unsigned long value; unsigned char bytes[4]; } LONGVALUE; I also have a function that has this prototype, char sendHexToASCII_UART(char *msg, int cnt); and a variable of type LONGVALUE defined as, LONGVALUE countAddr; THE PROBLEM: I f...

C++ unrestricted union workaround

#include <stdio.h> struct B { int x,y; }; struct A : public B { // This whines about "copy assignment operator not allowed in union" //A& operator =(const A& a) { printf("A=A should do the exact same thing as A=B\n"); } A& operator =(const B& b) { printf("A = B\n"); } }; union U { A a; B b; }; int main(int argc, c...

Non-LINQ implementations of Union, Intersect, and Except

LINQ to objects has the incredibly useful Union, Intersect, and Except methods. Sadly, there's a client I'm doing work for and they are mandating .NET 2.0 so LINQ is not an option. I looked through the reflected code and it didn't reverse well at all. Is there a .NET 2.0 library or easy implementation of Union, Intersect, and Except? ...

MySQL - Searching with UNION ALL and GROUP BY

SELECT p.id, p.title, p.uri, 'post' AS search_type FROM `posts` AS p WHERE title LIKE "%logo%" UNION ALL SELECT p.id, p.title, p.uri, 'tag' AS search_type FROM posts AS p INNER JOIN post_tags AS pt ON pt.post_id = p.id INNER JOIN tags AS t ON pt.tag_id = t.id WHERE t.title LIKE "%logo%" UNION ALL SELECT p.id, p.title, p.uri, 'c...

What's the point of this series of C typedef/struct/union/enum definitions?

Inside of this first step towards a bootstrapped scheme interpreter I find the following set of typedef, struct, union, and enum definitions: typedef enum {FIXNUM} object_type; typedef struct object { object_type type; union { struct { long value; } fixnum; } data; } object; In particular, I'm ...

tsql : Access query to TSQL union update conversion correct?

I have a query in access which i need to convert to a stored proc in sql server 2005. the query in access is as follows: UPDATE tblitem, tblFileSignature SET tblitem.strFileProcesstype = [tblFileSignature].[STRFILEPROCESSTYPE], tblitem.strFileSignatureType = [tblFileSignature].[strfilesignaturetype] WHERE (((tblitem.strFileSignatu...

C# HashSet union on IEnumerable within LINQ Func expression does not work (possible precompiler bug)

I am using using Microsoft .NET Framework 4.0. I have run into this using Aggregate on a Dictionary<T, List<T>> to extract the set of type T values used across all type List<T> lists in the dictionary. Here is the simplest case I could come up with that exhibits the same behaviour. First, as the documentation states, the following does...

Set_union/Set_intersect for more than two sets in c++

I know those commands are for two sets. Does there any simple and fast way to do this for more then two sets. I think I can use some kind of loop for this but maybe there are better way. Thank you ...

Union of Tables with Cursor in Android

Hi, I am trying to UNION two tables with the same fields to create a single cursor (through a content provider) that I am using to create my ListView. @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); Stri...

SharePoint 2010: efficient union query across site collections?

In SharePoint 2010, I would like to create a list in one SiteCollection that queries data from several other SiteCollections that have common fields: Is this possible, and if so - can it be done efficiently? The current proposed solutions involves setting up EventReceivers on each of the SiteCollections that we want to query, and upd...

mysql union vs multiple queries

I'm interested to know if a union is better than running multiple queries. If so, are there times that multiple queries would be faster or preferred for other reasons? ...

Need help with merging two data collections

Hello! I need to retrieve all items from two lists that contains a given value. Example: var list1 = { new Dummy(){ Name = "Dummy1", Number = 1 }, new Dummy(){ Name = "Dummy2", Number = 2 }, new Dummy(){ Name = "Dummy3", Number = 3 } }; var list2 = { new Dummy(){ Name = "Dummy4", Number = 4 }, new Dummy(){ Name = ...

What's the major difference between "union" and "struct" in C.?

Possible Duplicate: Difference between a Structure and a Union in C I could understand what a struct means. But, i am bit confused with the difference between union and struct. Union is like a share of memory. What exactly it means.? ...

Different query in the where section, how to transform into 1 query?

I have two simple queries select sum(deb)-sum(cre) as result1 from CXC where id='22731999' select sum(deb)-sum(cre) as result2 from CXC where id='22731999' and tipo='IM' the difference is the where, for example the first query results in 769686 and the second in 3469, what I have to do, to see the result of the two queries in one re...

mysql problem with union/join used in conjunction

I have these two tables: Table Author: ID (INTEGER), author_name (VARCHAR), first_name (VARCHAR), last_name (VARCHAR), preferred_name (VARCHAR) Table CoAuthored: ID (INTEGER) author1ID (INTEGER), author2ID (INTEGER), paper_ID (INTEGER) // (ID of the co-authored paper referenced by this link) As you can see, both tables have a colu...

SELECT INTO USING UNION QUERY

Hi, I want to create a new table in SQL Server with the following query. I am unable to understand why this query doesn't work. Query1: Works SELECT * FROM TABLE1 UNION SELECT * FROM TABLE2 Query2: Does not Work. Error: Msg 170, Level 15, State 1, Line 7 Line 7: Incorrect syntax near ')'. SELECT * INTO [NEW_TABLE] FROM ( SELECT *...

How to combine results from multiple tables with different columns?

I have several tables with different numbers and types of columns, and a single column in common. +--------+---------+------------+-------------+ | person | beardID | beardStyle | beardLength | +--------+---------+------------+-------------+ +--------+-------------+----------------+ | person | moustacheID | moustacheStyle | +--------+-...

SQL Using ORDER BY with UNION doesn't sort numbers correctly (e.g. 10 before 8)

I've tried looking for the answer, and read many threads on this site, but still can't find the answer I'm looking for. I am trying to sort a series of numbers that are real look-ups and also one * which isn't, I can sort fine when I don't need to add the fake * but not after. I have tried SELECT DISTINCT MasterTable.ClassName, Master...

Adding column contents in a SQL UNION query

So far I have this query SELECT COUNT(f.code_id) as item_count, f.code_desc FROM foo f INNER JOIN foohistory fh ON f.history_id = fh.history_id WHERE MONTH(fh.create_dt) = 6 AND YEAR(fh.create_dr) = 2010 GROUP BY f.code_desc UNION ALL SELECT COUNT(b.code_id) as item_count, b.code_desc FROM ...