0
I have 2 tables where I want to compare the price of products:
TABLE: PRODUCT
produto preco
A 4.5
B 6
C 10
TABLE: RANGE PRICE
produto valor minimo valor maximo
A 3.2 6.7
B 2.1 4.5
C null null
I would like to compare the price column with the minimum and maximum values of the Comparison table. If the value is within the range or the comparison data is null, I want to include that value in a third table. If the value is outside the range, I would like to replace it with 0 and also add a flag in the final table. In this example the final table would look like this:
TABLE: FINAL
produto preco final flag
A 4.5 0
B 0 1
C 10 0
Can anyone help me? I already tried to make a Join with parole and I couldn’t, I don’t know if this is the right way
Hello Lilian, your question seems too wide, have an HTML, until compare and insert in SQL has many steps, already have something code freito? what language you are using?
– Ricardo Pontual
Hi Ricardo, starting now to touch the stackoverflow... I set the tables, now I think they are visible... I’m working with SQL server, I tried to Join with case, but I couldn’t actually run..
– Lilian Kotvan
already managed to solve? post the current code to try to adjust..
– rLinhares