Why is a UDF so much slower than a subquery?

前端 未结 4 1455
臣服心动
臣服心动 2020-11-28 12:03

I have a case where I need to translate (lookup) several values from the same table. The first way I wrote it, was using subqueries:

SELECT
    (SELECT id FRO         


        
4条回答
  •  臣服心动
    2020-11-28 12:52

    Am I missing something? Why can't this work? You are only selecting the id which you already have in the table:

    select created_by as creator, updated_by as updater, 
    owned_by as owner, [name]
    from asset
    

    By the way, in designing you really should avoid keywords, like name, as field names.

提交回复
热议问题