Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Boolean aggregation
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
create table t (c1 text, c2 text); insert into t (c1, c2) values ('a','x'), ('a','y'), ('a','z'), ('b','x'), ('c','y'), ('d','x'), ('d','x'), ('e','x'), ('e','y'); -- not z select c1 from t group by c1 having not bool_or(c2 = 'z') ; -- only x select c1 from t group by c1 having bool_and(c2 = 'x') ; -- must have x and y and nothing else select c1 from t group by c1 having bool_or(c2 = 'x') and bool_or(c2 = 'y') and bool_and (c2 in ('x','y')) ; -- at least x and y select c1 from t group by c1 having bool_or(c2 = 'x') and bool_or(c2 = 'y') ;
absolute service time: 0,44 sec
edit mode
|
history
|
discussion
c1
1
c
2
b
3
e
4
d
c1
1
b
2
d
c1
1
e
c1
1
a
2
e
stackse - search stackoverflow differently