I get the feeling that you originally had one big (poorly performing?) statement, that you split in several statements and temp tables.
If that is the case, then you have not split the statement properly. Your 3rd statement (the one creates and populates #Q_2) not only references a table that is aliased as Cls, but also uses that alias for the derived table, and that derived table does have an "id" column.
If the above is that case, then I suggest to revert to your original query, and start the splitting process again.
Gert-Jan
No comments:
Post a Comment