Answer the question
In order to leave comments, you need to log in
Exclude fields in query with JOIN?
I suppose this is a trivial question, but for some reason I can not find a clear example.
There is a table, say users, with 30 fields, including a city_id foreign key associated with the cities table in which there are only two fields - id and name
. You need to perform a SELECT ... JOIN so that
users.city_id and cities.id
- got cities.name, but with a different field name, for example city, because name will be duplicated
- (not archival, but just in case) you need to exclude one field from users, but not by listing the remaining 29 and not assigning NULL to it
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question