Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
user_info桌子:
user_info
ui_id
name
created_by
users桌子:
users
user_id- PK
user_id
username
我想显示user_info表格的内容。该created_by字段user_id来自用户表,我想username在显示时将其更改为。
是否可以在单个查询中进行?请告诉我怎么做。
这会做
select ui.*, u.username from user_info ui join users u on u.id = ui.created_by
只需加入表格。