-2

I am trying to join 4 tables with different columns(with no common columns) can somebody help me with the syntax

  • How about SELECT * FROM a,b,c,d ? – rcs Aug 21 '18 at 08:19
  • 1
    Can you provide some more information about data? You do need a common key to join multiple tables or else it will lead to cross join and the joined data might not be meaningful. – conetfun Aug 21 '18 at 08:20
  • Add some sample table data and the expected combined result. (As formatted text, not images.) – jarlh Aug 21 '18 at 08:41
  • Please **[edit]** your question and add some [sample data](http://plaintexttools.github.io/plain-text-table/) and the expected output based on that data. [Formatted text](http://stackoverflow.com/help/formatting) please, [no screen shots](http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557). ([edit] your question - do **not** post code or additional information in comments) –  Aug 21 '18 at 08:45
  • Possible duplicate https://stackoverflow.com/questions/17582313/correct-way-to-select-from-two-tables-in-sql-server-with-no-common-field-to-join – SoConfused Aug 21 '18 at 13:30

1 Answers1

-1

You can use the following syntax:

select * 
  from table_1
  cross join table_2
  cross join table_3
  cross join table_4

It enables you to join tables without connecting them via common rows. If you want to filter data, you can still do it in WHERE clause.

Goran Kutlaca
  • 2,014
  • 1
  • 12
  • 18