Skip to content
Advertisement

Tag: union

SQLite: optimize query with union

This is my table definition: And this is my query + plan: So the index is used, but there is still a scan and a b-tree involved in the order by. I tried getting rid of them by adding more indexes, but I don’t get it working. Any ideas of an index which gets rid of the scan? Answer Your

While loop function union function end

I want to loop the code shown below. I would like to use the [getpublicholidays] function for a variable number of years and merge them (union). Unfortunately I don’t know how to use the function in a loop with union. Can someone help? Answer If you are looping for X years, each time you loop to a new year, you

FULL OUTER JOIN (or UNION) on 2 tables

I’m facing a SQL request issue. I’m not a SQL expert and I would like to understand my mistakes. My use case is to get all records of the first table + records of the second table that are not present in the first table. I’ve got 2 tables like this : First table “T-Finance par jalon ZOHO” (with 20

Oracle developer. ORA-01722 Invalid Number when using UNION

I have this problem: I have two tables: Table A and Table B, with the same column called PK_COLUMN that in both tables are numeric(8, 0). I want to make this union: And I got the next error code: ORA-01722 Invalid number. The problem is that when I execute the both parts of the union separately they work perfectly! Answer

Filter a Dataframe using a subset of it and two specific fields in spark/scala [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 10 months ago. Improve this question I have an Scala/Spark question. I’m using Spark 2.1.1. I have a Dataframe

Is there a more efficient way to append multiple columns from the same table?

I’d like to return multiple values from the same record, with different columns of the same type appended under one another. I could do multiple joins, but that seems very inefficient because of the multiple table scans. Returns: VisID Vis Home HomeID arenn001 Nolan Arenado Colin Moran morac001 badeh001 Harrison Bader Anthony Alford alfoa002 carld002 Dylan Carlson Yoshi Tsutsugo tsuty001

Concatenate 2 rows into one in SQL

I have a very simple data structure with just 3 tables: requests employees teams Basically, what I need is to concatenate 2 different SQL selects into one (so that the query could return just one row). If there’s an employee associated with a request, then return their name (title) and concatenate it with ‘ / ‘. Then, if there’s a

Advertisement