Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Query using 'greater than' or 'less than'
zodiacdm
✭
I understand how to do this with simple sql queries, though I do not know how to get the SQL driver to return a single number count in a custom query... Example, I can do both of the following.
return $this->SQL ->Select('t.TaskID', 'count', 'CountItems') ->From('Task t') ->Where($Column, $Value) ->Get()->FirstRow()->CountItems;
and
return $this->SQL->Query( "SELECT * FROM GDN_Task WHERE ProjectID = $ProjectID and (`DateDue` >= $Timestamp) ORDER BY DateDue asc" )->Get();
What I need is basically the combination of the two. I want to be able to count the number of items matching the greater or less than query, not return the entire rows.
Any help is greatly appreciated.
0
Comments
you mean like this:
for a where >=
e.g.
->Where("$BadgeType >=", ($BadgeNumber-1))
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Nice, thank you. I will try it out right now.
That worked, thank you. I am even able to use both greater and less than in two different where functions to find integers between two numbers.
Any chance you also know how to query where not equal to?
did you try
->Where("$BadgeType <>", ($BadgeNumber-1))
or
->Where("$BadgeType !=", ($BadgeNumber-1))r
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.