-1

Please help me

I have:

DECLARE @tbl1 TABLE(idfish INT)

INSERT INTO @tbl1 (idfish)
VALUES (10), (11), (12)

DECLARE @tbl2 TABLE(kindid INT)

INSERT INTO @tbl2 (kindid)
VALUES (1), (2)

SELECT * FROM @tbl1
SELECT * FROM @tbl2

Now, I want result have two columns Table(idfish, kindid) as:

10 1 ;11 1; 12 1; 10 2; 11 2; 12 2

After ';' as new row

Thank you very much!

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76
  • Possible duplicate of [How can an SQL query return data from multiple tables](http://stackoverflow.com/questions/12475850/how-can-an-sql-query-return-data-from-multiple-tables) – mkilmanas May 12 '17 at 09:38

2 Answers2

1

You can just join on a common value.

SELECT * FROM @tbl1
INNER JOIN @tbl2 ON 1 = 1
0

You just need a cross join:

select * from @tbl1 cross join @tbl2;
Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76