-1
I need to present the departments that had stock movement in Feb/2018 and those that had in Mar/2018. I need to use a union operator to show the results of the two queries each of them returning the one-month departments. In each query I should avoid repeated departments. I need to show the code and name of the department by ordering by the code of the same. 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), Purchases(2), IT(3), Management(4), Warehouse(5), Directorate(6), Financial(7), Stock(8), Customer Service(9))
CODDEP is a column and DESCRICAO is another column.
I couldn’t understand the question. First, what is the database? Mysql, Postgree, Oracle? " I need to use a union operator to show the results of the two queries each returning the departments for a month." What do you mean? If the results are all in the same table it is not necessary to perform any union, it is only code refinement.
– Rodrigo Rossi
Hello. DB is Postgress. The original question I have to solve is this: " Present the departments that had stock movement in Feb/2018 and those that had in Mar/2018. Use a union operator to display the results of the two queries each returning the one-month departments. In each query, repeated departments should be avoided. Show code and department name ordering by the code of the same."
– Wagner