0
Hello then I did but I’m not getting the name of the product and the value follows what I accomplished to analyze where I’m missing?
insert into ITEMS(ID_PEDIDO, ID_PRODUTO, QUANTIDADE)values(3, 7, 1)
SELECT
    A.NOM_PRODUTO,
    A.VAL_PRODUTO,
    B.QUANTIDADE,
    B.ID_PEDIDO AS 'ITEM ID'
    FROM TB_PRODUTOS A RIGHT JOIN ITEMS B ON
        A.ID_PRODUTO = B.ID_PEDIDO WHERE B.ID_PEDIDO=3  --seleciona o pedido 3
When displaying the order items I am unable to bring the name and values as shown below

How I carry the name and values will be?
Solved like this:
SELECT<br>
    C.ID_PEDIDO AS 'PEDIDO',
    --A.ID_PRODUTO,
    A.NOM_PRODUTO AS'PRODUTO',
    A.VAL_PRODUTO AS 'VALOR UNITARIO',
    B.QUANTIDADE,
    (A.VAL_PRODUTO * B.QUANTIDADE)AS 'VALOR TOTAL POR ITEM'
    --B.ID_PRODUTO,
    FROM TB_PRODUTOS A INNER JOIN ITEMS B ON
        A.ID_PRODUTO = B.ID_PRODUTO
        INNER JOIN TB_PEDIDOS C ON C.ID_PEDIDO = B.ID_PEDIDO
        WHERE C.ID_PEDIDO=3
            GROUP BY C.ID_PEDIDO,
            A.NOM_PRODUTO,
            A.VAL_PRODUTO,
            B.VAL_TOTAL ,
            B.QUANTIDADE

Do you want to create another table to insert the items? This?
– Sorack
Hello then the table wanted to know if I can use this or need to use another to be able to add the items with the order
– Jameson
Yes, in this case for the modeling to be correct it is necessary to create a table
Pedido_Itemor something similar with foreign key for thePedido.– Sorack
Beauty I’ll try to do
– Jameson