sql - Subquery automatically producing cross join -
i not why when follow example (from northwind datase in ms sql server) subquery on microsoft sql server management studio 2008 typing in code shown below,
select orders.orderid, (select customers.companyname customers customers.customerid = orders.customerid) company name orders, customers
this sql code subquery automatically gained cross join , become
select orders.orderid, (select customers.companyname customers customers.customerid = orders.customerid) company name orders cross join customers customers_1
i have played around several variation of no luck in eliminating problem. known bug microsoft sql server management studio 2008? if so, has been patched, how find patched? otherwise, how can report microsoft , them fixed quickly?
in actual query, need query/lookup name of particular table 50 times equating id , think dumb having join of sort because code crumpy, long, , performance may poor?
the subquery isn't causing cross join, lack of condition controlling join is. need this:
select orders.orderid, (select customers.companyname customers customers.customerid = orders.customerid) company name orders, customers orders.customerid = customers.customerid
Comments
Post a Comment