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. Do I need a pivot Query?

Do I need a pivot Query?

Scheduled Pinned Locked Moved Database
databasequestion
4 Posts 3 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
    GREG_DORIANcod
    wrote on last edited by
    #1

    this is my original query: INVOICE NC_DOC NC_VALUE ND_DOC ND_VALUE RC_DOC RC_VALUE 40842 137 130130 140 60000 3 130130 40842 137 130130 141 85060 3 130130 40842 138 -130130 140 60000 3 130130 40842 138 -130130 141 85060 3 130130 40842 139 190130 140 60000 3 130130 BUT Now i need some query like this doctype numberDoc doc_value NC_DOC 137 130130 NC_DOC 138 -130130 NC_DOC 139 190130 ND_DOC 140 60000 ND_DOC 141 85060 RC_DOC 3 130130

    M J 2 Replies Last reply
    0
    • G GREG_DORIANcod

      this is my original query: INVOICE NC_DOC NC_VALUE ND_DOC ND_VALUE RC_DOC RC_VALUE 40842 137 130130 140 60000 3 130130 40842 137 130130 141 85060 3 130130 40842 138 -130130 140 60000 3 130130 40842 138 -130130 141 85060 3 130130 40842 139 190130 140 60000 3 130130 BUT Now i need some query like this doctype numberDoc doc_value NC_DOC 137 130130 NC_DOC 138 -130130 NC_DOC 139 190130 ND_DOC 140 60000 ND_DOC 141 85060 RC_DOC 3 130130

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

      It looks like you have simply added the doctype column!

      Never underestimate the power of human stupidity RAH

      G 1 Reply Last reply
      0
      • M Mycroft Holmes

        It looks like you have simply added the doctype column!

        Never underestimate the power of human stupidity RAH

        G Offline
        G Offline
        GREG_DORIANcod
        wrote on last edited by
        #3

        yes!! using this 3 columns nc_doc nd_doc and rc_doc , and then transpose as DocType... any ideas!!!?

        1 Reply Last reply
        0
        • G GREG_DORIANcod

          this is my original query: INVOICE NC_DOC NC_VALUE ND_DOC ND_VALUE RC_DOC RC_VALUE 40842 137 130130 140 60000 3 130130 40842 137 130130 141 85060 3 130130 40842 138 -130130 140 60000 3 130130 40842 138 -130130 141 85060 3 130130 40842 139 190130 140 60000 3 130130 BUT Now i need some query like this doctype numberDoc doc_value NC_DOC 137 130130 NC_DOC 138 -130130 NC_DOC 139 190130 ND_DOC 140 60000 ND_DOC 141 85060 RC_DOC 3 130130

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #4

          It looks more like unpivot to me.

          People say nothing is impossible, but I do nothing every day.

          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