所以我试图为两个表执行 SQL 连接命令,但我得到了一个我不想要的输出。
> SELECT owners_table.ownerID, tenant_table.tenantID, tenant_table.apt_num, tenant_table.last_name, owners_table.last_name AS owner_last, tenant_table.phone,
owners_table.phone AS owner_phone
FROM owners_table INNER JOIN
tenant_table ON tenant_table.apt_status = 'ARCHIVED' AND owners_table.owner_status = 'ARCHIVED'
ORDER BY owners_table.apt_num"
In the output, it displays 5 records of 'stralman', but there is only one. I understand the join clause is trying to match it up but is there a way to display only 1 stralman for the 5 corresponding records?
http://i.stack.imgur.com/mfbWW.png
table structure:
1) tenant table: http://i.stack.imgur.com/BUxMH.png
2) owners table: http://i.stack.imgur.com/QqoKx.png