SQLite syntax for “ALL”

后端 未结 3 1845
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 14:40

Is there a way to do the following in SQLite?

select name
from   table
where  number >= ALL (

        
3条回答
  •  生来不讨喜
    2020-12-16 14:45

    SQLite does have an ALL keyword; but, it does not do what you want it to. (Fortunately, @lawrence's answer does.)

    While the ALL keyword is not permitted as part of the WHERE expression, the keyword can appear a couple of other places.

    From http://www.sqlite.org/lang_select.html:

    SELECT ALL * ...

    One of the ALL or DISTINCT keywords may follow the SELECT keyword in a simple SELECT statement. If the simple SELECT is a SELECT ALL, then the entire set of result rows are returned by the SELECT. If neither ALL or DISTINCT are present, then the behavior is as if ALL were specified.

    SELECT ... UNION ALL SELECT ...

    A compound SELECT created using UNION ALL operator returns all the rows from the SELECT to the left of the UNION ALL operator, and all the rows from the SELECT to the right of it. The UNION operator works the same way as UNION ALL, except that duplicate rows are removed from the final result set.

提交回复
热议问题