0
I need to build a VIEW with three fields, but one depends on the other to be calculated (two of them are from the same table on different lines need "link them"), how do I aggregate these fields in one place? The select’s are as follows::
SELECT Referencia FROM ZSF053 WHERE TpFat = 'ZREK'
SELECT Doc_orig FROM ZFI003 WHERE Referencia = (utiliza as referencias do select acima)
SELECT Referencia FROM ZFI003 WHERE Num_doc = (utiliza os Doc_orig do select acima)
You already know how to do
inner join
two-table? I’m asking this to know how to explain to you, I don’t want to seem like a "know-it-all" or judging you down, I just want to know the terrain– Jefferson Quesado
The last two select are from the same table?
– Caique Romero
@Caiqueromero vide rLinhares response
– Jefferson Quesado
Yes I know how to make two tables Inner Join,
– W.S. Silva
My problem is that the last two selects are from the same table, under different conditions, and to find a need of the other’s select
– W.S. Silva
@Jeffersonquesado I was going to answer similar putting alias in the tables, I just wanted to confirm if they were from the same table(I thought I could do with a single Join)
– Caique Romero
@W.S.Silva do autojunction, or junction/ Join of a table with itself, it works exactly the same as a traditional junction, but forces you to use it alias for the tables. See rLinhares' response, it made an autojunction of
ZFI003
with herself– Jefferson Quesado
@Caiqueromero we are 3 so xD
– Jefferson Quesado
Related: https://answall.com/q/214563/64969
– Jefferson Quesado
I didn’t know I could join a table with itself, that’s what I need, thank you very much
– W.S. Silva