jayseena
asked on
Script Case - SQL Query
Hi,
I am using Scriptcase for a project.
I have table as attached
In a grid I have the query "onRecord"
The resulting grid is
Notice the value 105 and 150 are repeated everywhere.
When I make SQL Query externally I get the result I wanted
Where I am getting wrong. Could some one throw some light, please.
Thanks
I am using Scriptcase for a project.
I have table as attached
In a grid I have the query "onRecord"
// Check for record
$check_sql = "SELECT sum(recip_export), sum(recip_import), sum(recip_origin_export), sum(recip_mm)"
. " FROM recip"
. " WHERE recip_supplier = '" . {recip.recip_supplier} . "'";
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]})) // Row found
{
{Exportation} = {rs[0][0]};
{Import} = {rs[0][1]};
{Exportation_Origin} = {rs[0][2]};
{move_manament} = {rs[0][3]};
}
else // No row found
{
{other_field} = '';
{other_region} = '';
}
The resulting grid is
Notice the value 105 and 150 are repeated everywhere.
When I make SQL Query externally I get the result I wanted
SELECT recip.recip_supplier, sum(recip.recip_export), sum(recip.recip_import)
FROM recip GROUP BY recip.recip_supplier
Where I am getting wrong. Could some one throw some light, please.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
However I managed to avoid that and grouped it in the query, as you suggested
Thanks for your help.