title: How can i solve this query in sql oracle?
body: <p>It's an exercise that is not solved in the book in which I am studying. 
  The goal is to find the seller who has had the highest number of sales per month, 
  during all the months for which there is registered information. The problem is that I do not know how to divide tuples into periods of one month.</p>
  
  <p>First table is:</p>
  
  <pre><code>Table Sellers
  
  Id_seller
  Name_Product
  </code></pre>
  
  <p>And the other one is:</p>
  
  <pre><code>Table Product
  
  Name_Product
  View_datetime
  Budget
  </code></pre>
  
  <p><strong>What did i do?</strong></p>
  
  <p>I made this query:</p>
  
  <pre><code>SELECT id_seller FROM(SELECT id_seller, COUNT(id_seller)
  FROM SELLERS INNER JOIN PRODUCT
  ON SELLERS.name_product = PRODUCT.name_product
  GROUP BY id_seller HAVING COUNT(id_seller)&gt;= 1
  ORDER BY 2 DESC)
  WHERE ROWNUM = 1;
  </code></pre>
  
  <p>The query returns me the seller that most sales has done, but not "per month since there are records" as the statement asks. Any ideas? I'm so lost...</p>
  
  <p>The idea is to compare the total sales of each salesman in this month (sysdate), with those of a month ago, two months ago ... so long as there are older records. And get the maximum from each seller. And then you print the seller with more sales from the previous list. If a seller sells 400 products this month(April, the sysdate), but another seller sold in October last year 500, the result would be the second seller . That's what I do not know how to do.</p>
  
  <p>Thanks ^^</p>