SQL Access报告查询

时间:2015-12-16 16:25:02

标签: sql report balance

我正在尝试使用sql生成报告,但我似乎无法使其正常工作。

你可以查看我的代码。

基本上我想要姓名,电话,所有含有余额的药物,然后是每位患者的总余额。

SELECT patient_info.p_name, Sum(patient_info.p_balanceOwing,    
patient_info.p_balanceOwing2, patient_balanceOwing3) AS SumOfp_balanceOwing, 
patient_info.p_phone, patient_info.p_medicationList, 
patient_info.p_balanceOwing2, patient_info.p_balanceOwing3, 
patient_info.p_medication3, patient_info.p_medication4, 
patient_info.p_medication5, patient_info.p_medication6
FROM patient_info
GROUP BY patient_info.p_name, patient_info.p_phone,   
patient_info.p_medicationList, patient_info.p_balanceOwing2, 
patient_info.p_balanceOwing3, patient_info.p_medication3, 
patient_info.p_medication4, patient_info.p_medication5, 
patient_info.p_medication6;

我非常感谢帮助

0 个答案:

没有答案