mysql - Strange Discrepancy In Queries Using UNIX_TIMESTAMP -


Can someone please explain the discrepancy in the following questions:

Question 1 (87 returns results ):

  User ID, created as WHERE from user 'cpnc_PaymentOrder' as usercount & gt; = UNIX_TIMESTAMP ('2011-03-01') From the user account of the URI & gt; 1   

Question 2 (returns 177 results):

  select userId, created as WHERE from COUNT (userId) usercount as `cpnc_PaymentOrder` & Gt; = UNIX_TIMESTAMP ('2011-02-01') UserAvailability Hosting Username & gt; 1   

Question 3 (return 55 results):

  select userId, COUNTER (userId) usercount as WHERE created from 'cpnc_PaymentOrder` & Gt; = UNIX_TIMESTAMP ('2011-02-01') and created & lt; UNIX_TIMESTAMP ('2011-03-01') UserAviving Hosting UserCount & gt; 1   

Now I think that the number of results from question 2 will be equal to the number of results from query 3. But this is not the case. For clarification, the question I want to write is:

  

'cpnc_PaymentOrder' created from SELECT userId & gt; = UNIX_TIMESTAMP ('2011-02-01') and created & lt; UNIX_TIMESTAMP ('2011-03-01') and User ID "appears at least one other record before '2011-03-01'"

Because you're comparing the number of groups .

See this on a small example:

  user_id | Made 1 2011-02-02 1 | 2011-02-02 1 | 2011-02-02 2. 2011-02-02 2. 2011-02-02 1 | 2011-03-02 1 | 2011-03-02 2 | 2011-03-02 2 | 2011-03-02   

The first query for this dataset will be returned to the two rows, the second will also return the 2 rows, the third will also return 2 rows.

Just your Group B and difference ( GROUP BY will be without math)

Comments