title: How to use SELECT inside COUNT in MYSQL
body: <p>I have this view:</p>
  <p>myVIEW: (id,percent)</p>
  <p>I want to make another view, which will be like this:</p>
  <p>LASTVIEW: (lastID, lastPR, counter)</p>
  <p>and in &quot;counter&quot;, in every line I want to have how money id`s have a bigger percent than the percent of this line. so I tried:</p>
  <pre><code>CREATE VIEW LASTVIEW(lastID, lastPR, counter) AS
  SELECT id AS lastID, percent AS lastPR
  COUNT (SELECT id FROM myVIEW WHERE percent &lt; lastPR) AS counter,
  FROM myVIEW;
  </code></pre>