I have 2 tables, one call SR7010
and another call SR3010
. The primary key of the two is the field R7_MAT and R3_MAT.
The query I'm trying to perform is this:
SELECT R7_FILIAL, R7_MAT, R7_DESCFUN, R7_DATA, R3_VALOR FROM SR7010 AS sr7
INNER JOIN SR3010 AS sr3 ON (sr3.R3_MAT = sr7.R7_MAT)
WHERE sr7.R7_MAT = 997
What happens is: the R3_VALOR field appears with the repeated data, but the other fields (starting with R7 ) appear normally, and when the field R3_VALOR
changes, the data in the R7 fields repeat, so on.
Howtomakeitbringtheinformationcorrectly,ieonly3lines,asbelow?
These are salary / charge change records.
Ex: In the first line, with the position of Assist Informatica, on the date of 20151029 , you have the salary 50,00 .
As of 20151115 , still as Computer Support, salary was changed to 55.00 .
As of 20151126 , the position changed to Anal. with the salary of 60,00 .
What happens is that the data is being listed 3 times (number of records of changes actually exist), but the value field, because it is another table, is perhaps displaying the same value 3 times to then change to another value and repeat again by 3 times (amount of change records), and so on.
When I search the SR7010 table with the R7_MAT field = 997 , the database returns 3 records. The same occurs when I search the SR3010 table with the R3_MAT field = 997 . It also returns 3 records, so I find it strange.