Calc Column / Sum from other table

QuestionsCalc Column / Sum from other table
bazel asked 10 years ago

I wrote a function to add new column which SUM column from another table.
The function is working good but I cannot sort or search in that column. Is there any other way to get this working ?

Here is the code
http://pastebin.com/BrDPWjup

3 Answers
Abu Ghufran answered 10 years ago

For search/sort, this must be part of main sql query, perhaps something like subquery.

bazel answered 10 years ago

I think I solved this with custom query in select_command
here is the solution if anyone needs
http://pastebin.com/fvkeknbz

Abu Ghufran answered 10 years ago

For search, you might need to use:

$col["dbname"] = "SUM(orders.material_quantity)";

After that, this will be used in WHERE clause and not the alias.

Your Answer

19 + 1 =

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?