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. how to add row to the result query

how to add row to the result query

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
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.
  • C Offline
    C Offline
    cellardoor0716
    wrote on last edited by
    #1

    i have a query that returns 2 rows and i want to add 1 row manualy, so the final query would return 3 rows. can anyone help me with this?

    cellardoor

    E E 2 Replies Last reply
    0
    • C cellardoor0716

      i have a query that returns 2 rows and i want to add 1 row manualy, so the final query would return 3 rows. can anyone help me with this?

      cellardoor

      E Offline
      E Offline
      Elina Blank
      wrote on last edited by
      #2

      Select your 2 rows into a view or temporary table, then add your additional row into that view/table. Final step: select everything from that table/view. Note: if you are using stored procedures, then temporary table will be deleted automatically when the stored procedure is done (at least in SQL 2005)

      Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

      1 Reply Last reply
      0
      • C cellardoor0716

        i have a query that returns 2 rows and i want to add 1 row manualy, so the final query would return 3 rows. can anyone help me with this?

        cellardoor

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3

        select Column1,Column2 from MyTable
        union
        select 9000 as Column1,'whatever' as Column2

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        C 1 Reply Last reply
        0
        • E Eric Dahlvang

          select Column1,Column2 from MyTable
          union
          select 9000 as Column1,'whatever' as Column2

          --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

          C Offline
          C Offline
          cellardoor0716
          wrote on last edited by
          #4

          thanks

          cellardoor

          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