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 dairy22 Texas 4000 smth4
Mike Situation glenn32 Jersey 1000 smth1
...
> table "people":
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
> table "countries"
conID postNum region
-------------------------
Jersey 1000 smth1
NYork 2000 smth2
London 3000 smth3
Texas 4000 smth4
! -> NUM is AUTO INCREMENT primary key, which i dont want it the output if possible.
Thanks for help in advance :))
解决方案
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