需要有关查询算术计算的帮助
我想计算特定期限内预订的平均入住率。我正在尝试的是(总家庭数)/(预订总数)和列应分组
第一个查询在下面给我
Total Family
2
3
1
1
1
3
和第二个给了我3,但完整的查询仍然给我与第一个查询相同的结果,即使我将第二个查询替换为' 3'
Total Family
2
3
1
1
1
3
尝试此查询:
SELECT COUNT( familymember.id ) AS 'Total Family'
FROM familymember,
reservation
WHERE familymember.fid = reservation.patientId
GROUP BY reservation.patientId/
(SELECT COUNT( reservation.id )
FROM reservation
WHERE reservation.checkout <> '0000-00-00'
AND reservation.checkin BETWEEN '2014-04-01' AND '2014-04-30'
)
测试此查询
SELECT COUNT( familymember.id ) AS 'Total Family'
FROM familymember,
reservation
WHERE familymember.fid = reservation.patientId
GROUP BY reservation.patientId /3
如果你对此有所帮助,我真的很感激。
由于