Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. + ---------- + --------- + --------- + -------- + ------------ + ---------- +
  2. | Field | Type | Null | Key | Default | Extra |
  3. + ---------- + --------- + --------- + -------- + ------------ + ---------- +
  4. | id | int(11) | NO | PRI | | auto_increment |
  5. | date | datetime | NO | | | |
  6. | a | int(11) | NO | | | |
  7. | b | int(11) | NO | | | |
  8. | c | int(11) | NO | | | |
  9. | d | int(11) | NO | | | |
  10. | e | int(11) | NO | | | |
  11. + ---------- + --------- + --------- + -------- + ------------ + ---------- +
  12. 7 rows
  13.  
  14. select day,hour,c,100.0*(a1/c) as percentage,a1 from
  15. (
  16. select day(date) as day,hour(date) as hour,count(*) as c, (select count(*) from t where a=1 and hour(date)=hour) as a1 from t group by hour(date)
  17. ) as T;
  18.  
  19. Error Code: 1054. Unknown column 'hour' in 'where clause'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement