Forums

WHERE statement Chronoconnectivity V5

smurf007 07 Mar, 2014
Hi guys,

How to use the WHERE statement in CCV5 like in the following example:

SELECT id, FROM TABLE 1 WHERE id NOT IN (SELECT id FROM TABLE 2)

Could you please help?

Regards,

Smurf
GreyHead 08 Mar, 2014
Hi smurf007,

I suspect that this isn't possible using the CCv5 WHERE box. It could possibly be done with a MySQL View but I'm not sure if CCv supports them (it was possible in CCv4 with a little code hack).

Bob
jason.clemens 29 Mar, 2014
To use LIKE in the conditional for CCv5 writ it like this
<?php
return array("model.field LIKE" => "%text%");
?>
luxhodge 30 Apr, 2014
I was able to get the WHERE statement working using this code:
<?php $param = JRequest::getVar('acceptedBy');
$accepted = "$param";
return array("acceptedBy" => "$accepted");
?>

acceptedBy refers to the name of a person who accepted an order (in this case). I read the name into a php variable called $accepted. Then I add the name to the SQL query using the return array statement. It works well.

It helped me a lot to turn on the debug function in the connectivity5 app I am using. That allowed me to examine the SQL query and adjust my code until I got what I wanted.

Hope this helps someone.

Erik
This topic is locked and no more replies can be posted.