graphs – Given a vertex in a digraph, is there a standard term for (the vertices reachable from it) union (the vertices reaching it)?

Question in title. Looking for whether there is a term that is, if not widely understood, at least citeable to a source.

This is equivalent to asking for the set of nodes that are comparable to the given node in the preorder induced by the digraph. But that’s as much of a mouthful as what I wrote in the title.

Example: Consider the following digraph.

Digraphxample

Given the above graph and the node y, I am looking for a term that refers to the set {u, v, w, y, z} but excludes x, because x is neither upstream nor downstream of y.

gn.general topology – When the union of open subsets of subsets is open

Let $X$ be a topological space and ${A_i}_{i in I}$ be a family of closed subsets of $X$ such that for $inot= j$ we have $A_icap A_j={}$. Now for each $iin I$ let $A’_i$ be an open subset of $A_i$ when considering $A_i$ as a subspace of $X$, that is, $A’_i=O_icap A_i$ for some open subset $O_i$ of $X$. Under what conditions (on $X$ or $A_i’s$ or…) we can deduce $cup_{iin I} A’_i$ is an open subet of $cup_{iin I} A_i$ ?

UNION não está consolidando a SOMA entre 2 tabelas PostgreSQL

Sou novo por aqui e estou buscando uma solução para este problema.
Tenho duas tabelas que somam valores de produção por hora de dois times distintos, porém, com o UNION ocorre a duplicação das linhas com a hora que contém valores.

Ex.:
Resultado da query A

QueryA

Resultado da query B

Resultado da query B

Resultado da query com UNION entre as duas tabelas

inserir a descrição da imagem aqui

Eu preciso que os valores das horas coincidentes sejam apresentados consolidados (somados).

SELECT DISTINCT
   TO_char(a.acodatinc,'HH24') AS hora,
   SUM(ap.acoparvallan) AS valor_acordo
FROM acordo a
 INNER JOIN acordo_parcela ap on ap.acocod = a.acocod
 INNER JOIN usuario u on u.usucod = a.acousuinc
 INNER JOIN devedor d ON d.devcod = a.devcod
WHERE a.acodatinc::DATE = current_date-1
AND a.acoati = 0
AND ap.acoparati = 0
AND d.devsal > 0
AND ap.acoparnum = 1
AND a.carcod = 621
AND u.usunom NOT ILIKE '%1987%'
AND u.usunom NOT ILIKE '%105%'
AND u.usunom NOT ILIKE '%463%'
AND u.usunom NOT ILIKE '%1992%'
AND u.usunom NOT ILIKE '%2014%'
GROUP BY TO_CHAR(a.acodatinc,'HH24')

 UNION 

SELECT
 x.hora_excecao::TEXT AS hora,
 SUM(x.valor) AS valor_acordo

FROM (
 SELECT DISTINCT

 (SELECT
   CASE 
   WHEN x.carqueevecod = 3 THEN x.carresiteval
   END AS valor
   FROM carteira_resposta_item x
   WHERE x.carcod = cri.carcod
   AND x.devcod = cri.devcod
   AND x.carqueevecod = 3
   ORDER BY carresdat DESC LIMIT 1
 ) AS valor,

 (SELECT
   CASE 
   WHEN x.carqueevecod = 7 THEN x.carresiteint::TEXT
   END AS vencimento
   FROM carteira_resposta_item x
   WHERE x.carcod = cri.carcod
   AND x.devcod = cri.devcod
   AND x.carqueevecod = 7
   ORDER BY carresdat DESC LIMIT 1
 ) AS hora_excecao

 FROM carteira_questionario_evento cqe,
   carteira_questionario_evento_o cqeo,
   carteira_resposta_item cri,
   carteira_resposta cr,
   devedor d
 WHERE cqe.carqueevecod = cqeo.carqueevecod
 AND cri.carqueevecod = cqe.carqueevecod
 AND cqe.carcod = cri.carcod
 AND cr.carcod = cri.carcod
 AND cr.devcod = cri.devcod
 AND d.carcod = cri.carcod
 AND d.devcod = cri.devcod
 AND cri.carcod = 621
 AND  cri.carresdat = current_date-1
)x
GROUP BY x.hora_excecao
ORDER BY hora

Microsoft Access Union 2 or more similar queries Errors

I’m trying to UNION 2 similar queries using SQL in Microsoft Access but I am getting the error

This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.

I have tested each query individually and they work but when I try to union them together I get the above error.

The queries are as follows:

SELECT 
  Bowls.(Product Code), 
  Bowls.(Product Name),

  (Bowls AP).Option1_Default AS (RT S),
  (Bowls AP).Option2_Default AS (RT B),

  (Bowls AP).Option1_Wholesale AS (WS S),
  (Bowls AP).Option2_Wholesale AS (WS B),

  (Gare Stock Count).(Invoice Cost) AS (US Price),

  ROUND( (((Gare Stock Count).(Invoice Cost)) / (Exchange Rate)) * (Costings), 2)  AS ($AUD LC),

  ROUND( ($AUD LC)*1.9*1.1, 2) AS (WS B +90%),

  ROUND( ($AUD LC)/(Gare Stock Count).(Box Size)*2.1*1.1, 2) AS (WS S +110%),

  ROUND( (WS B +90%)*1.25, 2) AS (RT B +135% or +125%),

  ROUND( (RT B +135% or +125%)/(Gare Stock Count).(Box Size), 2) AS (RT Sing),

  ROUND( (((Bowls AP).Option2_Wholesale/1.1)-($AUD LC))/($AUD LC), 2) AS Margin

FROM ((Gare Stock Count) 
  INNER JOIN Bowls ON (Gare Stock Count).(Product Code) = Bowls.(Product Code))
  INNER JOIN (Bowls AP) ON (Gare Stock Count).(Product Code) = (Bowls AP).(Product Code)
  WHERE (((Gare Stock Count).(Product Code)) LIKE 'G-*')

And

SELECT 
  (Boxes Containers).(Product Code), 
  (Boxes Containers).(Product Name),

  (Boxes Containers AP).Option1_Default AS (RT S),
  (Boxes Containers AP).Option2_Default AS (RT B),

  (Boxes Containers AP).Option1_Wholesale AS (WS S),
  (Boxes Containers AP).Option2_Wholesale AS (WS B),

  (Gare Stock Count).(Invoice Cost) AS (US Price),

  ROUND( (((Gare Stock Count).(Invoice Cost)) / (Exchange Rate)) * (Costings), 2)  AS ($AUD LC),

  ROUND( ($AUD LC)*1.9*1.1, 2) AS (WS B +90%),

  ROUND( ($AUD LC)/(Gare Stock Count).(Box Size)*2.1*1.1, 2) AS (WS S +110%),

  ROUND( (WS B +90%)*1.25, 2) AS (RT B +135% or +125%),

  ROUND( (RT B +135% or +125%)/(Gare Stock Count).(Box Size), 2) AS (RT Sing),

  ROUND( (((Boxes Containers AP).Option2_Wholesale/1.1)-($AUD LC))/($AUD LC), 2) AS Margin

FROM ((Gare Stock Count) 
  INNER JOIN (Boxes Containers) ON (Gare Stock Count).(Product Code) = (Boxes Containers).(Product Code))
  INNER JOIN (Boxes Containers AP) ON (Gare Stock Count).(Product Code) = (Boxes Containers AP).(Product Code)
  WHERE (((Gare Stock Count).(Product Code)) LIKE 'G-*')

As you can see both queries are very similar as the only difference is replacing Bowls with Boxes Containers.

Each of the previous queries works and produces the expected outputs but when i try to UNION them together Access doesn’t like it and gives the error.

The query with UNION

SELECT 
  Bowls.(Product Code), 
  Bowls.(Product Name),

  (Bowls AP).Option1_Default     AS (RT S),
  (Bowls AP).Option2_Default     AS (RT B),

  (Bowls AP).Option1_Wholesale   AS (WS S),
  (Bowls AP).Option2_Wholesale AS (WS B),

  (Gare Stock Count).(Invoice Cost) AS (US Price),

  ROUND( (((Gare Stock Count).(Invoice Cost)) / (Exchange Rate)) * (Costings), 2)  AS ($AUD LC),

  ROUND( ($AUD LC)*1.9*1.1, 2) AS (WS B +90%),

  ROUND( ($AUD LC)/(Gare Stock Count).(Box Size)*2.1*1.1, 2) AS (WS S +110%),

  ROUND( (WS B +90%)*1.35, 2) AS (RT B +135% or +125%),

  ROUND( (RT B +135% or +125%)/(Gare Stock Count).(Box Size), 2) AS (RT Sing),

  ROUND( (((Bowls AP).Option2_Wholesale/1.1)-($AUD LC))/($AUD LC), 2) AS Margin

FROM ((Gare Stock Count) 
  INNER JOIN Bowls ON (Gare Stock Count).(Product Code) = Bowls.(Product Code))
  INNER JOIN (Bowls AP) ON (Gare Stock Count).(Product Code) = (Bowls AP).(Product Code)
  WHERE (((Gare Stock Count).(Product Code)) LIKE 'G-*')

UNION

SELECT 
  (Boxes Containers).(Product Code), 
  (Boxes Containers).(Product Name),

  (Boxes Containers AP).Option1_Default  AS (RT S),
  (Boxes Containers AP).Option2_Default  AS (RT B),

  (Boxes Containers AP).Option1_Wholesale    AS (WS S),
  (Boxes Containers AP).Option2_Wholesale AS (WS B),

  (Gare Stock Count).(Invoice Cost) AS (US Price),

  ROUND( (((Gare Stock Count).(Invoice Cost)) / (Exchange Rate)) * (Costings), 2)  AS ($AUD LC),

  ROUND( ($AUD LC)*1.9*1.1, 2) AS (WS B +90%),

  ROUND( ($AUD LC)/(Gare Stock Count).(Box Size)*2.1*1.1, 2) AS (WS S +110%),

  ROUND( (WS B +90%)*1.35, 2) AS (RT B +135% or +125%),

  ROUND( (RT B +135% or +125%)/(Gare Stock Count).(Box Size), 2) AS (RT Sing),

  ROUND( (((Boxes Containers AP).Option2_Wholesale/1.1)-($AUD LC))/($AUD LC), 2) AS Margin

FROM ((Gare Stock Count) 
  INNER JOIN (Boxes Containers) ON (Gare Stock Count).(Product Code) = (Boxes Containers).(Product Code))
  INNER JOIN (Boxes Containers AP) ON (Gare Stock Count).(Product Code) = (Boxes Containers AP).(Product Code)
  WHERE (((Gare Stock Count).(Product Code)) LIKE 'G-*');

I should also note I would like to UNION more SELECTs to this query so a solution that only solves it for 2 SELECTs won’t be ideal.

I suspect that the problem might involve the calculations in the ROUND statements and repeating them multiple times but I’m not sure how I should go about changing them.

Any help would be greatly appreciated thanks.

php – Setencia Where no me funciona con UNION, JOIN entre otras

tengo ese codigo que funciona perfecto, eso lo que hace es traer todos los registros de todas las tablas del mes actual, pero lo que quiero es agregar una setencia que traiga solo los registros de la ‘licenciatipo’ que esta en la tabla novedad, pero no me trae nada.
ya probe poniendo:

SELECT * FROM novedad N FROM licenciatipo='Por Enfermedad'

y no me trae nada.

SELECT * FROM novedad N RIGHT JOIN empleados E
ON  N.id_empleado=E.id_empleado JOIN area A
ON E.area_id=A.id_area WHERE MONTH(fechaactual) = MONTH(CURRENT_DATE())
UNION (SELECT * FROM novedad N
RIGHT JOIN empleados E
ON  N.id_empleado=E.id_empleado
JOIN area A ON E.area_id=A.id_area
WHERE MONTH(f_actual) = MONTH(CURRENT_DATE()))

Can someone explain intuitively why union find works to find a cycle in an undirected graph?

Union find is a data structure (not an algorithm!) that maintains a collection of disjoint sets $mathcal{S} = { S_1, S_2, dots }$ under union operations (i.e., replace two sets with their union) and find operations (given an element $x$, report the set $S_i$ containing $x$).

Hopefully it is already clear to you that if, at any point in time, two distinct vertices $u$ and $v$ lie in the same set $S_i in mathcal{S}$ then there must be a path $pi$ from $u$ to $v$ in your input graph $G$.

Suppose then that you are examining a new edge $e=(u,v)$ and you discover that both $u$ and $v$ lie in the same set. We can obtain a cycle $C$ by adding edge $e$ to the path $pi$. Notice that $C$ lies entirely in $G$, as desired.

Union All of two tables based on month of a date in Oracle

I have two tables table_a and table_b as below. column invdate is of date datatype and column amount is of number datatype.

table_a

invdate amount
20-01-2021 50
20-01-2021 100
20-02-2021 50
20-03-2021 50

table_b

invdate amount
01-01-2021 250
01-02-2021 300
01-03-2021 40
01-03-2021 50

I am doing a UNION ALL of both tables to get the sum of the amounts based on only month and year.

SELECT to_char(invdate, 'MM-YYYY') as "Date", sum(amount) as "Total"
FROM
(
SELECT to_char(invdate, 'MM-YYYY'), amount
FROM table_a
UNION ALL
SELECT to_char(invdate, 'MM-YYYY'), amount
FROM table_b
)
GROUP BY to_char(invdate, 'MM-YYYY')
ORDER BY to_char(invdate, 'MM-YYYY') asc;

to get the final output like below

Date Total
01-2021 400
02-2021 350
03-2021 140

but it gives me the below error.

ORA-00904: "INVDATE": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
Error at Line: 10 Column: 18

What am I doing wrong here?

JPA / Hibernate – Union two or more entites and merge into one list

I´m trying to get a list from two different entities:

Entity1: Folder
Entity2: File

I would like to have a list of “Folders” and “Files”.
If I understood it correctly a UNION will not work in JPA.

I can create two queries and merge them in one list:

List<Object> endResult = new ArrayList<>();
List<Object> folderList = new ArrayList<>();
List<Object> fileList = new ArrayList<>();

endResult.addAll(folderList);
endResult.addAll(fileList);

This is currently working and I got a list, but it´s not sorted
I got at first the Folder and afterwards the Files.

How can this be fixed?
Any ideas?

analysis – The union of 2 circles can not be the pre-image of zero

I saw at one of my class notes from Analysis that the set $Csubset mathbb{R}^2$ (where $C$ is the union of two circles of radius 1, not two balls or two discs) can not be a set of the form $f^{-1}(0)$, where $f:mathbb{R}^2 rightarrow mathbb{R}$ is a $C^1$ map with $nabla f(x)neq 0_{mathbb{R}^2}$ for every $x in f^{-1}(0)$. However, I can not see how it can be true. Could someone give me a hand?