I am performing UNION while getting the same type of information (company_name, vat, and email) from two different tables (adv and pub). The SQL query is below: SELECT TRIM(UPPER(company_name)), vat, company_owner_email FROM ( (SELECT company_name, v
For several HTML forms, I want to configure inputs and deal with their values. My types have the following structure (you may copy it to TypeScript Playground http://www.typescriptlang.org/play to see it in action): interface InputConfig { readonly i
I need to run a query, that select two columns from a big table (3m+ rows, with selecting two columns, the result set is around 6-7m) and returns a list. So I used union to merge the columns into a list and also to eliminate duplicates. The problem i
I want to combine 3 queries with union operator "|" which is working fine, but I want to set priority per every query, so for example if first query will bring result then it needs to be node[0] example : //div[@class='class1'] | //div[@class='c
I would like to get all the jobs for a person, and count all the bids he received which is stored in a different table. I have one table with following rows: table jobs: jobId,userid,title And a different table with the following: table bids: jobId,a
I have 3 tables - one for users, one for their incoming payments, and one for their outgoing payments. I want to display all incoming and outgoing payments in a single result set. I can do this with multiple selects and a union but it seems cumbersom
select t1.tema, count(p.id_pregunta) as num_preguntas from preguntas p right join subtema s on p.id_subtema = s.id_subtema join tema t on t.id_tema = s.id_tema union select t1.tema, count(r1.id_respuesta) as preg_respuesta from respuestas r1 right jo
My SQL is quite rusty, so much that I have not created a view before and I am not entirely sure how to do what I need. Perhaps I need a stored procedure. Here is the deal. We have a a database of ticket history (purchases). We want to filter on a cer
Let's say that I need to find all persons that are enabled users of a specific registration type of a person... And I want the PersonId of the user, as well as the related registration's person. A person can have multiple registrations, multiple pers
I have two independent tables: Emp: id, name, bossid Data: d_id, d1, d2, d3, d4, d5 I would like to create a new table in postgreSQL: Goal: id, name, bossid, d_id, d1, d2, d3, d4, d5 What query would be suitable? EDIT Result table id | name | bossid
I have a situation where I want to combine two tables for queries in a select statement, and I haven't found a working solution yet. The Situation: Table A Table B Both A and B have identical fields but distinct populations. I have other queries that
I want to receive results like the sample output. Listed each day beween two dates and the number of online posts from a company. For example: TABLE id | online_From | online_To | comp_id 11 | 2014-04-02 | 2014-04-05 | 20 12 | 2014-04-11 | 2014-04-16
can i join between two sql satatmnet example select ID, NAME from tab1; 12|blabla and Select DESC from tab2; vvvvvv I want to display to 12|blabla|vvvvvv I was try the the UNION select ID, NAME from tab1; UNION Select DESC from tab2; but the result w
TABLE X col1,col2 1 , 2 1 , 7 1 , 4 1 , 8 2 , 3 2 , 1 2 , 2 3 , 1 3 , 8 3 , 9 3 , 4 4 , 5 4 , 3 4 , 2 4 , 8 4 , 4 I want to retrieve the col1 values that contains in the col2 the values 2 and 4 in this case it will retrieve the values 1 and 4 How can
I have searched for this code online to merge several lists and return one. The code works if all properties are string but I get an error if some of the properties are double. This error is "Operator '??' cannot be applied to operands of type 'doubl
As title. i have seen this, people all saying that we should consider union all first for the performance, my question is which one should i use when i want to eliminate duplicate records. i have seen that developer use union all to search the record
This is my code import java.util.Arrays; class union { public static void main(String args[]) { int[] A = new int[1000]; int[] B = new int[1000]; int[] C = new int[2000]; for (int i= 3;i < 1000 ; i += 3) { A[i/3] = i; } for (int j=5; j < 1000; j +=
I need to perform 'n' unions using mysqli (where n changes based on user input). For instance: select a from b where a=c[1] UNION select a from b where a=c[2] ... UNION select a from b where a=c[n] Is there anyway to do this iteratively? Something li
I've got a query (which works) to show the average number of replies to messages containing specific keywords. But I think it could be optimised - we're worried that as the database grows this query will become very slow, especially if we use a large
the table id string ------------ 1 aaa 2 bbb 3 ccc 4 ddd the query (SELECT string FROM table WHERE id > 1 ORDER BY id ASC LIMIT 1) /* num_row = 1 */ UNION (SELECT string FROM table WHERE id < 1 ORDER BY id DESC LIMIT 1) /* null */ UNION (SELECT stri
I'm trying to get the zip codes and the # of calls for that zip code for 2 tables I have, patients and physicians. I'm getting the #of calls by counting the zip code, like if there are 5 patients with zip code 79555 then the count would be 5. If pati
So here's my question (i'm using Oracle SQL by the way) I have 3 result queries from my database (one is total number of hotels, one is number of hotels being constructed and one is number of hotels completed). How do you join all three queries, so t
Summary So I have 3 tables, which I have screenshots below. Every user will get 10 slides by default when they sign up, so that information is in the "slides" table. The template_id is just another table I have which is identical to the custom_s
Union with NHibernate and Criteria: Is it possible in Criteria or QueryOver? If not, is there any other way to achieve a union of two result within the same query?You can't do a union directly, but you can do two future queries and union the results
here my query- SELECT final.* into #FinalTemp from ( select * from #temp1 UNION select * from #temp2 UNION select * from #temp3 UNION select * from #temp4 )final but at a time only one temp table exists so how to check if #temp exists then do union o
I have a SQL query that is working well except I would like to bring the results of another column in the first db with it. This is what I currently have: SELECT parts1.PART_NBR, parts1.NIIN FROM parts1 WHERE parts1.PART_NBR='$pn' UNION SELECT parts2
right to business. I have an activity feed which gets all different kinds of activity from different parts of my site sorts them all out by means of using UNION and an ORDER BY and then a LIMIT to get the top 25 and then displays the activity. My fel
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
We have a Union Query. Here's a basic (similar) example: SELECT a.Name, b.Info FROM a LEFT JOIN b ON (a.ID = b.ID) WHERE a.Name LIKE "a%" UNION SELECT a.Name, b.Info FROM a LEFT JOIN b ON (a.ID = b.ID) WHERE a.Name LIKE "b%" ORDER BY a
How do I fix that error once and for all? I just want to be able to do unions in MySQL. (I'm looking for a shortcut, like an option to make MySQL ignore that issue or take it's best guess, not looking to change collations on 100s of tables ... at lea