AnsweredAssumed Answered

SugarQuery with a Where clause field LIKE '%58%'

Question asked by Kenneth Brill on Nov 13, 2017
Latest reply on Dec 10, 2017 by Harald Kuske

I have a field in my DB, it is type INT.   Lets call it test_int so

 

<?php

$query = new SugarQuery();
$query->from(BeanFactory::getBean('Accounts'));
$query->select(array('id', 'name', 'test_int'));
$query->where()->contains('test_int', '58');
$returnArray = $query->execute();

the SQL I get is

SELECT  accounts.id id, accounts.name name, accounts.test_int test_int FROM accounts 
LEFT JOIN accounts_cstm ON accounts_cstm.id_c = accounts.id 
WHERE accounts.deleted = 0 AND accounts.test_int LIKE 58

Which pulls up no records, what am I doing wrong?  I want '%58%' for the where clause.

Outcomes