Hi,
According to http://doc.silverstripe.org/framework/en/topics/datamodel when you do a raw SQL query and you use a left join the object created will not return the additionally joined data. In the example below i need to search for both customers' phone numbers as well as claim numbers. The phone numbers is stored in the Customer object and the claim numbers in the Claim object. There is a one to many relationship between Customers and claims. I need the sql query to return the claim numbers as well. How do i do that?
$customer = Customer::get()
->leftJoin("Claim", "\"Claim\".\"CustomersID\" = \"Customer\".\"ID\"")
->where
("
(Tel1 = '$tel1' OR Tel1 = '$tel2' OR Tel1 = '$tel3')
(ClaimNo = '$claim')
");
return $this->customise(array(
'Results' => $customer
))->renderWith(array('CustomerSearch','Page'));