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. SQL Tables

SQL Tables

Scheduled Pinned Locked Moved Database
databasequestion
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.
  • I Offline
    I Offline
    Illegal Operation
    wrote on last edited by
    #1

    I need some advice. I have 2 tables. They are not related in any way except that they are in the same DB. Now I need to write a select query where it returns the columns from table1 and columns from table2. How can I achieve this? My Query at the moment is: SELECT Table1.Column1, Table1.Column2, Table2.Column1 AS EXPR1 FROM Table1 CROSS JOIN Table1 AS Table2 Thank you in advance!!

    Illegal Operation Making Computer Software Talk

    K 1 Reply Last reply
    0
    • I Illegal Operation

      I need some advice. I have 2 tables. They are not related in any way except that they are in the same DB. Now I need to write a select query where it returns the columns from table1 and columns from table2. How can I achieve this? My Query at the moment is: SELECT Table1.Column1, Table1.Column2, Table2.Column1 AS EXPR1 FROM Table1 CROSS JOIN Table1 AS Table2 Thank you in advance!!

      Illegal Operation Making Computer Software Talk

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Since the tables are not related in any way it probably makes sense to return multiple result sets. If you are calling a stored procedure, which I highly suggest, you could just do this: Select column1, column2 from table1 select column1 as expr1 from table2 Then you would get two results sets to work with. Hope that helps. Ben

      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