Guest User

Untitled

a guest
May 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. SELECT * FROM table WHERE createdon > SUBDATE(NOW(), '7 day') ORDER BY hits DESC;
  2.  
  3. create table daily_hits {
  4. cid integer, -- content id points to the table you already have
  5. dotw smallint, -- 0-6 or similar
  6. hits integer
  7. PRIMARY KEY (cid, dotw)
  8. }
  9.  
  10. SELECT * WHERE
  11. DATEDIFF(NOW(),created_date) < 7
  12.  
  13. SELECT * FROM table WHERE Date_Created > (7 days ago value) ORDER BY Hits LIMIT 0,100
  14.  
  15. SELECT * FROM table WHERE Date_Created > SUBDATE(NOW(), '7 day') ORDER BY Hits LIMIT 0,100
Add Comment
Please, Sign In to add comment