Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

execute a request p...
 
Notifications
Clear all

execute a request personalized

6 Posts
2 Users
0 Reactions
3,697 Views
(@yassine)
Posts: 26
Active Member
Topic starter
 
[#857]

i can't execute this request with sqlElement :dry:
SELECT count(distinct `idResource`,`workDate`)FROM `work` WHERE `week`=201248


 
Posted : 11 Dec 2012 19H34
(@babynus)
Posts: 14952
Member Admin
 

Not really ANSI SQL compliant.
Try

select count(*) from 
(SELECT distinct `idResource`,`workDate` FROM `work` WHERE `week`=201247) as ww

 
Posted : 11 Dec 2012 20H12
(@yassine)
Posts: 26
Active Member
Topic starter
 

this is my code

$Ressource=SqlList::getList('Resource');
foreach($Ressource as $keyresource => $valresource)
{
$crit=array('week'=>$y.''.$week);
$obj=new Work();
$Jours=$obj->countSqlElementsFromCriteria($crit);
}


 
Posted : 11 Dec 2012 20H16
(@yassine)
Posts: 26
Active Member
Topic starter
 

So i should modify the file sqlElement.php.
But i try this way w and i can't create a new function to generate a request to reply this need.


 
Posted : 11 Dec 2012 21H26
(@babynus)
Posts: 14952
Member Admin
 

Sure this code

$Ressource=SqlList::getList('Resource');
foreach($Ressource as $keyresource => $valresource) 
{ 
$crit=array('week'=>$y.''.$week);
$obj=new Work();
$Jours=$obj->countSqlElementsFromCriteria($crit);
}

will not generate

SELECT count(distinct `idResource`,`workDate`)FROM `work` WHERE `week`=201248

unless you changed SqlElement code (I stongly recommand against this !).
It will more likely generate

select count(*) as cpt from work where week='201248'

 
Posted : 11 Dec 2012 22H31
(@babynus)
Posts: 14952
Member Admin
 

Maybe if you describe what you try to get (and not how you try to get it), answers may be more helpfull. 😉


 
Posted : 11 Dec 2012 22H34
Share:

Scroll to Top