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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Saving Matrix Data

Saving Matrix Data

Scheduled Pinned Locked Moved Database
tutorialquestion
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.
  • G Offline
    G Offline
    Greeky
    wrote on last edited by
    #1

    Imagine a matrix, S M L XL color1 10 20 30 0 color2 4 5 45 50 color3 1 0 4 5 You a sample matrix what i work on. columns are quantity of sizes (some of them may equals to 0 ) . Rows are colors. rows count and columns count are variable. How to save them to data base. rows are in a table, size are saved on other table. But i couldnt solve how to save values on table. what do you offer to me ?

    C 1 Reply Last reply
    0
    • G Greeky

      Imagine a matrix, S M L XL color1 10 20 30 0 color2 4 5 45 50 color3 1 0 4 5 You a sample matrix what i work on. columns are quantity of sizes (some of them may equals to 0 ) . Rows are colors. rows count and columns count are variable. How to save them to data base. rows are in a table, size are saved on other table. But i couldnt solve how to save values on table. what do you offer to me ?

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      A table containing three columns (to which you must add a primary key - unless size and colour are the primary key)

      Size Colour Quantity
      S 1 10
      S 2 4
      S 3 1
      M 1 20
      M 2 5
      M 3 0
      ....

      Your matrix is a pivoted varient of what I have shown above. Does this help?


      "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog

      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