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 |
manners
Starting Member
1 Post |
Posted - 2012-10-04 : 03:53:47
|
Hi, I need help with a join. Relatively new to SQL.Any help greatly appreciated.Here's the code:set identity_insert idx_ref_attribute_type ongoInsert into idx_ref_attribute_type (idx_attribute_type_id, type_desc, value_type, daily_change, purpose)Select idx_factor_type_id, factor_type_desc, factor_value_type, daily_change, factor_purposeFrom idx_factor_typeinner join idx_attribute_type on idx_ref_attribute_type.membershp_attribute = idx_attribute_type.membership_attribute set identity_insert idx_ref_attribute_type offThe error I get is: [Error] Script lines: 3-23 ------------------------- The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.Without the inner join and following line it works perfectly! =( Cheers |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-10-04 : 04:15:19
|
I only could answer like this:The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead. Too old to Rock'n'Roll too young to die. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-10-04 : 05:10:04
|
quote: Originally posted by manners Hi, I need help with a join. Relatively new to SQL.Any help greatly appreciated.Here's the code:set identity_insert idx_ref_attribute_type ongoInsert into idx_ref_attribute_type (idx_attribute_type_id, type_desc, value_type, daily_change, purpose)Select idx_factor_type_id, factor_type_desc, factor_value_type, daily_change, factor_purposeFrom idx_factor_typeinner join idx_attribute_type on idx_ref_attribute_type.membershp_attribute = idx_attribute_type.membership_attribute set identity_insert idx_ref_attribute_type offThe error I get is: [Error] Script lines: 3-23 ------------------------- The column prefix 'idx_ref_attribute_type' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead.Without the inner join and following line it works perfectly! =( Cheers
Try this oneFrom idx_factor_typeinner join idx_attribute_type on idx_factor_type.membershp_attribute = idx_attribute_type.membership_attribute i think u mistakenly wrote idx_ref_attribute_type--Chandu |
|
|
|
|
|
|
|