union

Handle Union of List in C# with duplicates

Hi, I am trying to understand how to handle union or merge of two lists that can have duplicates. For example, List1 has { A, B, C} and List2 has { B, C, D }. I tried to use the Union operation and got a new list with values (A, B, C, D}. However, I need the B & C values from the second list, not first one. Is there a way to specify the ...

Incremental Union?

I'm trying to describe a Sudoku Board in C++ with a union statement: union Board { int board[9][9]; int sec1[3][3]; int sec2[3][3]; int sec3[3][3]; int sec4[3][3]; int sec5[3][3]; int sec6[3][3]; int sec7[3][3]; int sec8[3][3]; int sec9[3][3]; } Would each section of the board correspond wi...

Anonymous union definition/declaration in a macro GNU vs VS2008

I am attempting to alter an IAR specific header file for a lpc2138 so it can compile with Visual Studio 2008 (to enable compatible unit testing). My problem involves converting register definitions to be hardware independent (not at a memory address) The "IAR-safe macro" is: #define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)...

In SQL, a Join is actually an Intersection? And it is also a linkage or a "Sideway Union"?

I always thought of a Join in SQL as some kind of linkage between two tables. For example, select e.name, d.name from employees e, departments d where employees.deptID = departments.deptID In this case, it is linking two tables, to show each employee with a department name instead of a department ID. And kind of like a "linkage"...

In SQL, we can use "Union" to merge two tables. What are different ways to do "Intersection"?

In SQL, there is an operator to "Union" two tables. In an interview, I was told that, say one table has just 1 field with 1, 2, 7, 8 in it, and another table also has just 1 field with 2, and 7 in it, how do I get the intersection. I was stunned at first, because I never saw it that way. Later on, I found that it is actually a "Join" ...

C++ union data-structure, easy acccess of bits within a DWORD

Im running through a set of DirectX tutorials online and I have the following structure: struct CUSTOMVERTEX { FLOAT x, y, z, rhw; // from the D3DFVF_XYZRHW flag DWORD color; // from the D3DFVF_DIFFUSE flag } My basic understanding of directX leads me to thing tha color is made up of 8-bit alpha, red, green and blue channels. ...

how to place struct in union

Hello, I have an union X. It's size is 64bits. How can I write (if possible) its declaration if I want to access those 64 bits as: 1. 4 int16_t: p,q,r,s; 2. Array of 4 int16_t: a[4] 3. 2 int32_t: n, m; 4. Array of 2 int32_t: b[2] 5. 1 int64_t z; ...

How to extract ALL typedefs and structs and unions from c++ source

I have inherited a Visual Studio project that contains hundreds of files. I would like to extract all the typedefs, structs and unions from each .h/.cpp file and put the results in a file). Each typdef/struct/union should be on one line in the results file. This would make sorting much easier. typdef int myType; struct myFirstStruc...

using union in a construct sparql query

hello, i have such a sparql query: select ?s ?p ?o from <http://localhost:8890/DAV/ranking&gt; where { {<http://seekda.com/providers/cdyne.com/PhoneNotify&gt; so:hasEndpoint ?s. ?s ?p ?o} union {<http://seekda.com/providers/cdyne.com/PhoneNotify&gt; ?p ?o} } but i need a graph query (construct ord describe). unfortunatly i have no...

how to convert sql union to linq

I have the following Transact SQL query using a union. I need some pointers as to how this would look in LINQ i.e some examples wouldbe nice or if anyone can recommend a good tutorial on UNIONS in linq. select top 10 Barcode, sum(ItemDiscountUnion.AmountTaken) from (SELECT d.Barcode,SUM(AmountTaken) AmountTaken FROM [Aggregation].[dbo...

How to cast C struct just another struct type if their memory size are equal?

I have 2 matrix structs means equal data but have different form like these: // Matrix type 1. typedef float Scalar; typedef struct { Scalar e[4]; } Vector; typedef struct { Vector e[4]; } Matrix; // Matrix type 2 (you may know this if you're iPhone developer) // Defines CGFloat as float for simple description. typedef float CGFloat; s...

Trouble with Unions in C program.

I am working on a C program that uses a Union. The union definition is in FILE_A header file and looks like this... // FILE_A.h**************************************************** xdata union { long position; char bytes[4]; }CurrentPosition; If I set the value of CurrentPosition.position in FILE_A.c and then call a function in FILE_...

SPARQL UNION - Result set incomplete

I have two queries: query 1: SELECT DISTINCT ?o COUNT(?o) WHERE { ?s1 ?somep1 <predicate_one-uri>. ?s1 ?p ?o} query 2: SELECT DISTINCT ?o COUNT(?o) WHERE {?s2 ?somep2 <predicate_two-uri>.?s2 ?p ?o.} Each query gives me a different result set (as expected). I need to make a union of these two sets, from what I understand the...

MYSQL JOIN SELECT Statment - omit duplicated

Hi, I am tying to join the following 2 queries but I am having duplicated .... it is possible to remove duplacted fro this: ( SELECT bar_id, bar_name, town_name, bar_telephone, (subscription_type_id *2) AS subscription_type_id FROM bar, sportactivitybar, towns, subscriptiontype WHERE sport_activity_id_fk =14 AND bar_id = b...

How can I perform this query between related tables without using UNION?

Suppose I have two separate tables that I watch to query. Both of these tables has a relation with a third table. How can I query both tables with a single, non UNION based query? Here's a theoretical example. I have a User table. That User can have both CDs and books. I want to find all of that user's books and CDs with a single query ...

Oracle SQL: Multiple Subqueries Unioned Without Running Original Query Multiple Times.

So I've got a very large database, and need to work on a subset ~1% of the data to dump into an excel spreadsheet to make a graph. Ideally, I could select out the subset of data and then run multiple select queries on that, which are then UNION'ed together. Is this even possible? I can't seem to find anyone else trying to do this and ...

SELECT table name that is inside UNION

I have two same tables. I need to union them in such way: SELECT f1,f2, xxx FROM (SELECT * FROM tbl1 UNION ALL SELECT * FROM tbl2) where xxx would query for a table name, where f1 and f2 fields are taken from. Example output: 123 345 'tbl1' -- this rows are from the first table 121 345 'tbl1' 121 345 'tbl1' 1...

Union struct produces garbage and general question about struct nomenclature

I read about unions the other day( today ) and tried the sample functions that came with them. Easy enough, but the result was clear and utter garbage. The first example is: union Test { int Int; struct { char byte1; char byte2; char byte3; char byte4; } Bytes; }; where an int is as...

What is the difference between union and join?

What is the difference between the SQL keywords union and join? ...

one query instead of four - is it possible?

i must get data from four tables. i wrote the script with four queries, but i use it in ajax, and i wan't to do it by one query. here is queries... $query1 = "SELECT `id`,`name_ar` FROM `tour_type` ORDER BY `order`"; $query2 = "SELECT `id`,`name_ar` FROM `hotel_type` ORDER BY `order`"; $query3 = "SELECT `id`,`name_ar` FROM `food_type` O...