M
M
Max Trophy2017-01-12 13:39:25
SQL
Max Trophy, 2017-01-12 13:39:25

How to use cross join t-sql?

How to use Cross join but not for tables, but something like this:

(select N'Один',  N'Два')   cross join
(select  N'Три',   N'Четыре')

?
This request swears: Wrong syntax near cross

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2017-01-12
@kapitoly

select
*
from (select N'One' as column1, N'Two' as column2) as table1
cross join (select N'Three' as col1, N'Four' as col2) as table2
or whatever you like:
select
table1.column1 ,
table2.col1,
table1.column2,
table2.col2
from (select column1 = N'One' , column2 = N'Two') as table1
cross join (select col1 = N'Three', col2 = N'Four' ) as table2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question