我查询抛出这样的错误MySQL的选择查询错误
select id,cHospital from med_patient where cHospital is not null union
select id,cHospital1 from med_patient where cHospital1 is not null union
select id,cHospital2 from med_patient where cHospital2 is not null order by 1
的错误是
注意:未定义指数:cHospital1在F:\ WAMP \ WWW \ MMR-最终\ ADMIN \ all_hospital_list.php线97上
说明:未定义指数:cHospital2在F:\瓦帕\ WWW \ MMR-最终\管理员\ all_hospital_list.php上线98
不冰:未定义的索引:cHospital1在F:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php在线97
注意:未定义的索引:c:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php线98
说明:未定义指数:cHospital1在F:\瓦帕\ WWW \ MMR-最终\管理员\ all_hospital_list.php线97上
说明:未定义指数:cHospital2在F:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php on line 98
注意:未定义的索引:cHospital1在F:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php在线97
注意:未定义指数:cHospital2在F:\瓦帕\ WWW \ MMR-最终\管理员\ all_hospital_list.php上线98
说明:未定义指数:cHospital1在F:\瓦帕\ WWW \ mmr-线最终\管理员\ all_hospital_list.php 97
说明:未定义指数:cHospital2在F:\瓦帕\ WWW \ MMR-最终\管理员\ all_hospital_list.php上线98
说明:未定义指数:cHospital1在线97:F:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php
Noticias e:未定义的索引:在98行的F:\ wamp \ www \ mmr-final \ admin \ all_hospital_list.php中的cHospital2`
并且它也抛出Null行。
如何将此查询更改为不会导致错误?
问题不在于查询,而在于PHP。你可以发布完整的文件或至少更多的周边代码? – Tom 2010-01-15 19:08:19
http://pastebin.com/m4fbf313d – Bharanikumar 2010-01-15 19:23:20
我告诉你我在想什么.. 看到我有三个字段,chospital,chospital1,chospital2,在tbl1表中,我有大约50个病人条目,有些病人可能有chostial1,chosptail2,有些病人有一个chopsital代码,我想渲染tbl2表中的所有代码,我不想在我的outout中重复,也没有null值.. – Bharanikumar 2010-01-15 19:26:07