php - mysql查询失败

标签 php mysql

mysql查询有点问题

我有两个表A和B

table A {id, name, gender}
table B{id, name, salary}

我想查询name, gender, salary,但我的查询似乎只有namegender

查询是:

select * from tableA inner join tableB on tableB.id=tableA.id ;

最佳答案

SELECT a.name, a.gender, b.salary
FROM tableA AS a
LEFT JOIN tableb AS b ON(a.id = b.id)
WHERE 1;

关于php - mysql查询失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9461679/

相关文章:

email - 如何通过 PHP 设置电子邮件发件人的姓名

php - 如何在PHP中运行大循环

asp.net - 我想将 "An error occurred object reference not set to an instance of an object while insert and update new record"插入数据库

mysql - 将 AWS Aurora 使用的 MySQL 版本与 MySQL Docker 镜像相匹配

mysql - 使用一行从另一个表中选择两行

php - 在 PHP 中释放内存

php - 如何通过python设置php的$_GET和$_POST变量?

php - Laravel 5 - 在 Rest API 服务器上自定义 JSON 响应

php - 如何在提交之前使用 jquery ajax 验证表单?

php - 为什么 php 时间戳与 future 日期的 mysql UNIX_TIMESTAMP 不同?