我有这两张桌子.连接密钥"是两个表中都包含的 conID.所以现在我想写一个 select 语句,它会给我这样的东西:
I have these two tables. The connecting "key" is conID which is included in both tables. So now i would like to write select statement which would give me something like this:
John Smith 乳品 22 Texas 4000 smth4
John Smith dairy22 Texas 4000 smth4
Mike Situation glenn32 Jersey 1000 smth1...
Mike Situation glenn32 Jersey 1000 smth1 ...
>表人":
NUM Name lastName address conID
-----------------------------------------
1 John Smith dairy22 Texas
2 Mike Situation glenn32 Jersey
3 Duke Nukem haris48 NYork
4 Queen Lisa court84 London
>表国家"
conID postNum region
-------------------------
Jersey 1000 smth1
NYork 2000 smth2
London 3000 smth3
Texas 4000 smth4
<强>!-> NUM 是 AUTO INCREMENT 主键,如果可能的话,我不希望它是输出.
提前感谢您的帮助:))
Thanks for help in advance :))
这应该返回您想要的行,基于 num
列:
This should return the rows you want, based on the num
column:
SELECT Name, lastName, address, people.conID, postNum, region
FROM people
JOIN countries
ON people.conID = countries.conID
WHERE num=1
这篇关于在 SELECT(MYSQL/PHP) 中加入 2 个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!