(update Set) Blocked field = 1 when there is no sells to one client.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raosistemas
    New Member
    • Jan 2013
    • 1

    (update Set) Blocked field = 1 when there is no sells to one client.

    have a table client.
    ---------------------
    code Int
    blocked tinyint
    name varchar

    have a table sells.
    ---------------------
    data date
    client Int
    total float

    I want update blocked field with 1 when there is no sells for the client.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You should not store the blocked field as that breaks the rules of normalization. Instead you should calculate it as needed.

    Comment

    • Anas Mosaad
      New Member
      • Jan 2013
      • 185

      #3
      Adding to Rabbit's statement, you have computed fields saved in the database if you want save some processing but you don't care about the size of your data. In some cases, you need to de-normalize for the sake of performance.
      If you know that already and still want to keep the field in the DB, you may create a before insert trigger that does this for you.

      Comment

      Working...