Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that something else might be going wrong. Replicating your question like:</p> <pre><code>create table `Registration_Summary` ( id integer primary key, promoter varchar(200) ); insert into `Registration_Summary` (id, promoter) values (1, 'bar1'); insert into `Registration_Summary` (id, promoter) values (2, 'bar2'); insert into `Registration_Summary` (id, promoter) values (3, 'bar3'); insert into `Registration_Summary` (id, promoter) values (4, 'foo1'); insert into `Registration_Summary` (id, promoter) values (5, 'foo1'); insert into `Registration_Summary` (id, promoter) values (6, 'foo1'); insert into `Registration_Summary` (id, promoter) values (7, 'foo1'); insert into `Registration_Summary` (id, promoter) values (8, 'afoo1'); insert into `Registration_Summary` (id, promoter) values (9, 'bfoo1'); insert into `Registration_Summary` (id, promoter) values (10, 'cfoo1'); </code></pre> <p>Selecting from the Registration table </p> <pre><code>select * from `Registration_Summary` where promoter like 'foo%'; </code></pre> <p>Will produce the following output</p> <pre><code>+----+----------+ | id | promoter | +----+----------+ | 4 | foo1 | | 5 | foo1 | | 6 | foo1 | | 7 | foo1 | +----+----------+ </code></pre> <p>and </p> <pre><code>select * from `Registration_Summary` where promoter not like 'foo%'; </code></pre> <p>will produce the following </p> <pre><code>+----+----------+ | id | promoter | +----+----------+ | 1 | bar1 | | 2 | bar2 | | 3 | bar3 | | 8 | afoo1 | | 9 | bfoo1 | | 10 | cfoo1 | +----+----------+ </code></pre> <p>So creating the view like you have</p> <pre><code>create or replace view testview as (select 'NUMBER OF BRAND PARTNERS ACTIVE PROMOTERS' AS `NUMBER OF ACTIVE PROMOTERS`,count(*) AS `COUNT( * )` from `Registration_Summary` where promoter not like 'foo%'); </code></pre> <p>and then selecting from the view</p> <pre><code>SELECT * FROM testview; </code></pre> <p>Produces the correct output which is </p> <pre><code>+-------------------------------------------+------------+ | NUMBER OF ACTIVE PROMOTERS | COUNT( * ) | +-------------------------------------------+------------+ | NUMBER OF BRAND PARTNERS ACTIVE PROMOTERS | 6 | +-------------------------------------------+------------+ </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload