Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. need good database structure for tracking counter state

need good database structure for tracking counter state

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Dear, Can anyone help me to make good database structure? What i have are some locations where I have some machines. Every machines have 2 counters (IN and OUT). I need to be able to enter state of that counters and after that to compare that values with previous entry IN and OUT counters. How I see it seams that somewere I need to keep information wich machine is on wich location. Beside that I need to track information about date and time of entries. Situation: Location 1 -> machine1, machine2, machine3 Location 2 -> machine4 Location 3 -> machine5, machine6, machine7, machine8 .... I need 3 kind of reports: ○ Deference between new IN / OUT and some old IN/OUT counters for every machine ○ Total IN/OUT for some location ○ Total IN/OUT for all location How I need to organize this datas? Thanks for helping me, akioki

    M 1 Reply Last reply
    0
    • L Lost User

      Dear, Can anyone help me to make good database structure? What i have are some locations where I have some machines. Every machines have 2 counters (IN and OUT). I need to be able to enter state of that counters and after that to compare that values with previous entry IN and OUT counters. How I see it seams that somewere I need to keep information wich machine is on wich location. Beside that I need to track information about date and time of entries. Situation: Location 1 -> machine1, machine2, machine3 Location 2 -> machine4 Location 3 -> machine5, machine6, machine7, machine8 .... I need 3 kind of reports: ○ Deference between new IN / OUT and some old IN/OUT counters for every machine ○ Total IN/OUT for some location ○ Total IN/OUT for all location How I need to organize this datas? Thanks for helping me, akioki

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      3 tables

      Location
      LocationID int identity(1,1)
      Location varchar(20)

      Machine
      MachineID int identity (1,1)
      LocationID int
      Machine varchar(20)

      TranTable
      TranID identity (1,1)
      MachineID
      Direction
      Date

      This assumes a machine can have only 1 location and the machine can be checked in/out many times. Using a date on the transaction table will allow you to get durations, and state on a given date

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups