我是新來的sql,我試圖劃分兩個選擇語句,但沒有得到正確的答案。我越來越70,但答案應該是9.20% 我在這裏做錯了什麼?劃分兩個Select語句?
select count(clocked_in_at - starts_at)
from master_shift
where clocked_in_at is not null
and clocked_in_at <> starts_at
and date_part('minute', clocked_in_at - starts_at) > 0
/
(select count(id) from master_shift where clocked_in_at is not null)
starts_at clocked_in_at
"2015-10-15 18:00:00+00";"2015-10-15 18:15:00+00"
"2015-10-20 17:00:00+00";"2015-10-20 17:00:00+00"
"2015-10-21 20:30:00+00";"2015-10-21 20:30:00+00"
"2015-10-22 20:00:00+00";"2015-10-22 20:00:00+00"
"2015-10-23 17:00:00+00";"2015-10-23 17:00:00+00"
"2015-10-23 20:30:00+00";"2015-10-23 20:30:00+00"
"2015-10-24 18:30:00+00";"2015-10-24 18:30:00+00"
"2015-10-26 17:45:00+00";"2015-10-26 17:45:00+00"
"2015-10-26 20:30:00+00";"2015-10-26 20:30:00+00"
"2015-10-27 15:54:00+00";"2015-10-27 15:54:00+00"
你能提供的樣本數據? –
@DarshanMehta - 我已經添加了示例數據 – bumblebeez