标签: php mysql database
我要做的是连接table1中的用户ID以连接table2中的用户名。而不是在页面上显示他的用户名。减少冗余。
有人能让我上路吗?
答案 0 :(得分:1)
用于跨表将数据绑定在一起的SQL join适用于这种情况。语法将类似于:
select username from table1 join table2 on table1.userId = table2.userId