Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
create table t ( id int, c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, sts int ); insert into t values (1, 1, 0, 0, 2, 1, 1, 1, 0), (2, 1, 0, 0, 2, 1, 1, 1, 0), (3, 0, 0, 0, 1, 1, 1, 1, 0), (4, 0, 0, 0, 0, 1, 1, 1, 0) ; SELECT id FROM t, jsonb_each_text(to_jsonb(t)) as x("key",val) group by id having count(*) filter(where val::int = 0) <=3 and count(*) filter(where val::int = 1) <=4;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear