2个表中有相同的字段 怎么办

WBOY
Release: 2016-06-13 12:10:54
Original
1555 people have browsed it

2个表中有相同的字段 怎么处理?
比如A里面有name字段,B里面也有name字段,这关联在这起怎么知道取的是那个值呢

------解决思路----------------------
select A.name as a_name,B.name as b_name from A,B where...

有条件自己加上就是了。这样就能区分各自的字段了。
------解决思路----------------------
select A.name as a_name,B.name as b_name from A,B where... 

 $u->a_name;


------解决思路----------------------
字段前面加上“表名.”,用别称更好 alias

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template