title: get rows if all foreign rows are inactive
body: <p>I have the following two tables. An "Account" can can many "Ads"</p>
  
  <p>An account can have many ads.</p>
  
  <p>I want to come up with a query that returns: any account that does not have any ads with the column <code>active</code> set to true.</p>
  
  <p>If the account does not have any ads, then the query should not return it. And if only one of the ads related to that account has an ad with the column active set to true, then that should not be returned as well.</p>
  
  <pre><code>CREATE TABLE public.account
  (
      id bigint NOT NULL DEFAULT nextval('account_id_seq'::regclass),
      password text COLLATE pg_catalog."default",
      insert_time timestamp with time zone DEFAULT now(),
      email_account_id bigint,
      phone_number text COLLATE pg_catalog."default",
      active boolean NOT NULL DEFAULT true,
      CONSTRAINT account_pkey PRIMARY KEY (id),
      CONSTRAINT account_email_account_id_fkey FOREIGN KEY (email_account_id)
          REFERENCES public.email_account (id) MATCH SIMPLE
          ON UPDATE CASCADE
          ON DELETE CASCADE
  )
  
  
  CREATE TABLE public.ad
  (
      id bigint NOT NULL DEFAULT nextval('model_id_seq'::regclass),
      name text COLLATE pg_catalog."default" NOT NULL,
      insert_time timestamp with time zone DEFAULT now(),
      ad_url text COLLATE pg_catalog."default",
      account_id bigint NOT NULL,
      active boolean NOT NULL DEFAULT true,
      CONSTRAINT ad_pkey PRIMARY KEY (id),
      CONSTRAINT ad_account_id_fkey FOREIGN KEY (account_id)
         REFERENCES public.account (id) MATCH SIMPLE
         ON UPDATE CASCADE
         ON DELETE CASCADE
  )
  </code></pre>