Using Join statements within G – select_command

QuestionsUsing Join statements within G – select_command
Devon asked 8 years ago

I put together a join statement to sum numbers together in the select_command but when it do a search/edit it comes up with errors. I think i'm going to try to go around this by pushing this an update before the grid starts but was hoping there maybe a fix to this?

My current code sits like this:

$g->select_command = "SELECT * from rmprogram rmp
left join (select rmname,
SUM(tva IS NOT NULL and tva <> '') as tv,
SUM(int2a IS NOT NULL and int2a <> '') as internet,
SUM(pha IS NOT NULL and pha <> '') as phone,
SUM(ph2a IS NOT NULL and ph2a <> '') as phone2,
SUM(sata IS NOT NULL and sata <> '') as satellite,
(SUM(tva IS NOT NULL and tva <> ''))+
SUM(int2a IS NOT NULL and int2a <> '') +
(SUM(pha IS NOT NULL and pha <> ''))+
(SUM(sata IS NOT NULL and sata <> '')) as total
from rmreferral
where rmname != ''
group by rmname)

rmf ON rmp.rmid = rmf.rmname
AND rmp.rmStatus != 'SUB'";

The numbers display fine but you cannot edit or search after that

2 Answers
Abu Ghufran answered 8 years ago

Thanks for sharing.

Devon answered 8 years ago

Update: Running an update function before the phpgrid works pretty good.

Your Answer

5 + 8 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?