Home > Database > Mysql Tutorial > body text

三表查询 MYSQL句子_MySQL

WBOY
Release: 2016-06-01 13:06:36
Original
955 people have browsed it
SELECT cp.cname, cp.cprice, dc.dcsum, cp.cprice*dc.dcsum as fensu,sj.sjname FROMcp,dc,sj WHERE cp.cno=dc.dcno AND cp.sjno = sj.sjnohittlle原来这么简单。。。我想复杂了。。注意:三个表a,b,c 查询的时候要注意他们之间要有牵制,比如 a.s=b.s and a.s=c.s 这样,否则会有重复的东西出来,就算加了distinct 只会减少重复,而不能避免重复。
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!