Здравствуйте, kRaB, Вы писали:
Это
SELECT [unit_types].[type_id], COUNT([units].[unit_id]) AS [type_count]
INTO [#temp]
FROM [unit_types]
FULL JOIN [units] ON [unit_types].[type_id] = [units].[type_id]
FULL JOIN [units_in_containers] ON [units_in_containers].[unit_id] = [units].[unit_id]
WHERE [units_in_containers].[con_id] = 1
GROUP BY [unit_types].[type_id]
SELECT [unit_types].[type_id], [#temp].[type_count] AS [type_count]
FROM [unit_types]
FULL JOIN [#temp] ON [#temp].[type_id] = [unit_types].[type_id]
DROP TABLE [#temp]
Лучше в транзакцию запихать. Чтоб #temp удалялась. Или моздание временных таблиц не ранзакцируется? Вот это уже не помню