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 |
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2001-07-13 : 16:06:04
|
| I have an SP that is called from within a cursor. The SP uses a single value that is passed(a key value on all associated tables for this process) we'll call this value customer number. In one of the select queries I have a convoluted select statement that uses two joins and the passed customer in the where clauseSo basically we havepass in @customerSelect...fromtable1 tb1join table2 tb2 on tb2.customer = tb1.customerjoin table3 tb3 on tb3.customer = tb2.customerwhere tb1.customer = @customer.Since I can easily create a table with @customer info in it very quickly and put indexes on it, wouldn't it be easier to simply put a left join just after "table1 tb1" likeleft join newtable nt on nt.customer=tb1.customerThis is a huge convoluted select statement but on thing is true, all the tables involved should be tied together by customer.Basically an aggregate record is being create from the multiple field in the multiple tables tied by customer. I didn't wan't to get too mired in details. If I misunderstand the use of left join, feel free to correct me.Thanks,Cat |
|
|
|
|
|