Union Junction Operator [closed]

-1

I need to show the departments that had stock movements in Feb / 2018 and those that had in March / 2018. I need to use a joining operator to show the results of the two queries each returning the departments for a month. In every query I should avoid repeated departments. I need to show the code and name of the department by ordering the code for it. This table below is the stock movement table (MOVESTOQUE)

My department table (DEPARTMENT) is this: CODDEP 1, 2, 3, 4, 5, 6, 7, 8, 9 DESCRIPTION Sales (1), Purchasing (2), IT (3), Management (4), Warehouse (5), Management (6), Financial (7), Stock (8), Customer Service (9) >

CODDEP is a column and DESCRICAO is another column.

    
asked by anonymous 10.10.2018 / 02:57

1 answer

0
select distinct
coddep,
dthora

from
movestoque

where
dthora between '2018-02-01' and '2018-02-28'

UNION

select distinct
coddep,
dthora

from
movestoque

where
dthora between '2018-03-01' and '2018-03-31'
    
10.10.2018 / 16:15