Tuesday, 15 May 2012

sql server - SQL Join Commands -


Then im trying to execute SQL join command for two tables, but not receiving an output IM is. & gt; Select owners_table.ownerID, tenant_table.tenstID, tenant_table.apt_num, tenant_table.last_name, own_last as owners_table.last_name, tenant_table.phone, owners_table.phone owners_table as owner_table within tenant_table tenant_table.apt_status based on combinations = 'ARCHIVED 'And' owners_table.owner_status = 'ARCHIVED' command '

by owners_table.apt_num, it displays 5 records of' stralman ', but there is only one. I understand the section of joining is trying to match it but is there a way to display only 1 strollman for 5 related records?

Table structure: 1) Tenant table:
2) Owner table:

You do not have a connection between two tables in joining. You need at least one condition in the section on your one side of the position, one expression from the table on the other side of the condition and the other side of the condition for an expression from another table, such as:

  FROM Enter the tenant_table.apt_num = owners_table.apt_num tenant_table on the owners_table interiors   

Note that this is OK, joining the condition for your needs, because we can not know from the information provided. Can not be done that other pillars Any owner may have to relate to a tenant.

No comments:

Post a Comment