Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + ---------- + --------- + --------- + -------- + ------------ + ---------- +
- | Field | Type | Null | Key | Default | Extra |
- + ---------- + --------- + --------- + -------- + ------------ + ---------- +
- | id | int(11) | NO | PRI | | auto_increment |
- | date | datetime | NO | | | |
- | a | int(11) | NO | | | |
- | b | int(11) | NO | | | |
- | c | int(11) | NO | | | |
- | d | int(11) | NO | | | |
- | e | int(11) | NO | | | |
- + ---------- + --------- + --------- + -------- + ------------ + ---------- +
- 7 rows
- select day,hour,c,100.0*(a1/c) as percentage,a1 from
- (
- 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)
- ) as T;
- Error Code: 1054. Unknown column 'hour' in 'where clause'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement