#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Report of inventory issue..


    Code:
    +------------+     +-----------------+     
    | record     |     | record_items    |     
    +------------+     +-----------------+    
    |RecordID(PK)|>--->| RecordID (FK)   |  
    |PatientID   |     | ItemID          |     
    |Precription |     | Amount          |
    |VisitDate   |     +-----------------+
    +------------+
    this 2 is the table i created, my problem is there is many items to store in a "ReportID",so is that all store in a row or not?

    Code:
    ---------------------------------------------
    |ReportID | ItemID  |  Amount  |
    ----------|---------|----------|-------------
    |   1     |    1    |   10     |
    |   1     |    2    |   50     |
    |   1     |    5    |   100    |
    -------------------------------------
    or the table look like this? each item store in a row,but still same id?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Report of inventory issue..


    Code:
    +------------+     +-----------------+     
    | record     |     | record_items    |     
    +------------+     +-----------------+    
    |RecordID(PK)|>--->| RecordID (FK)   |  
    |PatientID   |     | ItemID          |     
    |Precription |     | Amount          |
    |VisitDate   |     +-----------------+
    +------------+
    this 2 is the table i created, my problem is there is many items to store in a "ReportID",so is that all store in a row or not?

    Code:
    ---------------------------------------------
    |ReportID | ItemID  |  Amount  |
    ----------|---------|----------|-------------
    |   1     |    1    |   10     |
    |   1     |    2    |   50     |
    |   1     |    5    |   100    |
    -------------------------------------
    or the table look like this? each item store in a row,but still same id?
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,204
    Rep Power
    4279
    Originally Posted by choong1990
    or the table look like this? each item store in a row,but still same id?
    yes, the latter, one row per item
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo