AnsweredAssumed Answered

Use join on temp tables

Question asked by Nalin Agrawal on Jun 13, 2016

How do I create temp tables here? So if I have to achieve something like this in SQL, I will write this -

Select *

Into NewTable

From Jobs

Where jobID in (list of IDs)

And deleted = 0

 

SELECT count(id) as cnt
FROM applicants a
INNER JOIN NewTable n on a.id = n.applicantId
WHERE a.deleted = 0

 

drop table NewTable;

 

In SugarCRM, how will I access this NewTable, in the next query,  if I write a query like this?

PS - I am using this syntax in the method of my REST API -

$sql = "something...";

  $results = $db->query($sql, true);

  while($row = $db->fetchByAssoc($result) ){

       $data['id']['pipeline'] = $row['cnt'];

  }

Outcomes