SQL: I need my 2nd table with FK of the 1st automatically updated

Asked

Viewed 30 times

-3

I have a Sales_order table with Order Number and other information and created a table with FK of the 1st. I want every time a new order automatically falls in the 2nd (Requested) with the column Status null same...

The only way to do this is through Trigger? And how do I deal with legacy data?

Expected result:

Table: Situacao_Pedido

Pedido |    Status
======================
00001  |  Em produção
00002  |  Coletado      
00003  |  Pronto
00004  |  Novo
00005  |  Novo
  • Why is this "Status" not a request column? It seems to be a 1:1 relation

  • Because I need to have a production order and also has a "order item status", and in addition it is a standard table of my e-commerce and it would be good not to touch

  • In this case I would go by Trigger.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.