SQL Efficiency: WHERE IN Subquery vs. JOIN then GROUP

后端 未结 7 1645
予麋鹿
予麋鹿 2021-02-07 09:35

As an example, I want to get the list of all items with certain tags applied to them. I could do either of the following:

SELECT Item.ID, Item.Name
FROM Item
WH         


        
7条回答
  •  无人及你
    2021-02-07 10:09

    SELECT Item.ID, Item.Name
    ...
    GROUP BY Item.ID
    

    This is not valid T-SQL. Item.Name must appear in the group by clause or within an aggregate function, such as SUM or MAX.

提交回复
热议问题