Help on "At least one" query writing Given a matrix t1 as below, I want to verify the field id_ has at least one 'b' on column value1. Could you help me build the query?
CREATE TABLE IF NOT EXISTS t1 (
   id_ INTEGER  NOT NULL,
   value1 INT NOT NULL
)

CREATE TABLE IF NOT EXISTS result (
   id_ INTEGER  NOT NULL,
   is_b INT NOT NULL
)

INSERT INTO t1 (id_, value1) VALUES
(1, 'a'),
(2, 'a'),
(2, 'b'),
(3, 'a'),
(4, 'b'),
(5, 'a')

INSERT INTO result (id_, is_b) VALUES
(1, 0),
(2, 1),
(3, 0),
(4, 1),
(5, 0)

Thank you very much!
SELECT `id_`, 
       MAX(CASE WHEN `value1` = 'b' THEN 1 ELSE 0 END) as `is_b`
  FROM `t1`
 GROUP BY `id_`
 ORDER BY `id_`;

If you want that to go into result, slap an INSERT on top of it.