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. Dynamic column based on row

Dynamic column based on row

Scheduled Pinned Locked Moved Database
cssdatabasesql-servercomsysadmin
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.
  • R Offline
    R Offline
    Ramkumar_S
    wrote on last edited by
    #1

    Hi All, I have two tables (sql server) MainTable --------- Emp_code BasicPay TotalAddition ------- -------- -------------- 160 3000 200 161 4000 100 Additions Table -------- trx_amount desc emp_code ---------- ---- -------- 100 Bonus 160 100 Transport 160 20 Bonus 161 30 Transport 161 50 Food 161 My output grid should be like this Emp_code Basicpay Bonus transport Food TotalAddition(total of additions) -------- --------- ------ --------- ------ ------------- 160 3000 100 100 0 200 161 4000 20 30 50 100 Please suggest with this

    Ramkumar ("When you build bridges you can keep crossing them. ") http://ramkumarishere.blogspot.com

    D 1 Reply Last reply
    0
    • R Ramkumar_S

      Hi All, I have two tables (sql server) MainTable --------- Emp_code BasicPay TotalAddition ------- -------- -------------- 160 3000 200 161 4000 100 Additions Table -------- trx_amount desc emp_code ---------- ---- -------- 100 Bonus 160 100 Transport 160 20 Bonus 161 30 Transport 161 50 Food 161 My output grid should be like this Emp_code Basicpay Bonus transport Food TotalAddition(total of additions) -------- --------- ------ --------- ------ ------------- 160 3000 100 100 0 200 161 4000 20 30 50 100 Please suggest with this

      Ramkumar ("When you build bridges you can keep crossing them. ") http://ramkumarishere.blogspot.com

      D Offline
      D Offline
      dasblinkenlight
      wrote on last edited by
      #2

      You need to pivot[^] the "Additions" table, before joining it to the "MainTable" on emp_code.

      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