How to use MAX() on a subquery result?

后端 未结 7 1851
名媛妹妹
名媛妹妹 2021-02-07 08:48

I am new to Oracle and the SQL world. I have a slight issue with a query that I cannot figure out for the life of me, I have spent a few hours trying different approaches and I

7条回答
  •  旧时难觅i
    2021-02-07 09:39

    This is all good SQL.

    The best way to find a column value using the max primary key column value is:

    SELECT .... from tablename
    WHERE ... AND
      (SELECT max(primary key name) FROM tablename WHERE .... ) = primary_key_name
    

    this example will return a scalar value.

提交回复
热议问题