CROSS JOIN with one empty table sql server -
i have 2 tables myfull , myempty. need combination of records both tables. sometimes, myempty table might have no records, in scenario need return records myfull. have tried:
--q1 >> returns no results select * myfull cross join myempty --q2 >> returns no results select * myfull, myempty i though of using left join have no common key join on. sqlfiddle
try this:
select * myfull left join myempty on 1=1 though aware if have multiple records in myempty, repeat records myfull once every record in myempty. effectively, number of records in results myfull * myempty (unless myempty has no records).
Comments
Post a Comment