Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
shanmugaraj
Posting Yak Master
219 Posts |
Posted - 2013-05-14 : 03:10:46
|
I need to insert an result into my main table. Insert into main_table (country_id, state_id ) ( (SELECT distinct country_id from [dim_country]) , (SELECT distinct state_id from [dim_state]) ) Expected Result =================== 1 | 101 1 | 102 1 | 103ERROR Msg 512, Level 16, State 1, Line 2Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.THANKSSHANMUGARAJnshanmugaraj@gmail.com |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-14 : 03:41:37
|
[code]Insert into main_table (country_id, state_id)SELECT country_id,state_idFROM(SELECT distinct country_id from [dim_country])cCROSS JOIN (SELECT distinct state_id from [dim_state])s[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|