In the case of SQL join query, if the columns names for the tables are similar then the value is overridden and is set to nil as returns array of hashes, Let say there are two tables having two similar column names i.e. CustomerID. Then, we recommend creating an alias of the columns and use below mentioned Query. Here crm_customer and crm_md are considered as two different tables with similar column CustomerID.
1) SELECT crm_customer.CustomerID as cid, crm_customer.*, crm_md.* from crm_customer left outer JOIN crm_md ON crm_customer.CustomerID = crm_md.CustomerID
2) SELECT crm_md.*, crm_customer.* from crm_customer left outer JOIN crm_md ON crm_customer.CustomerID = crm_md.CustomerID