This topic is locked

Advanced Search not working with 'Group by' and 'where

10/13/2008 5:22:56 PM
PHPRunner General questions
B
bozzo author

Ok, I have a "board" place entirely made of sql query, containing some group by and where clauses.
When I define a certain interval of time in the advanced search, it doesn´t filter the data.
The groups continues to group the WHOLE TABLE and the....the only thing is filtered is the count of how many records....
so...is there any way I can make the Advanced Search filter the WHOLE query??? not only the main array???

J
Jane 10/14/2008

Yuri,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

B
bozzo author 10/17/2008

Jane..
I posted to my own website...
check http://www.sa2.com.br/Grafs/Ramais_Pesquisa_list.php, check the Ligacoes(calls), Unicos (uniques) and atendidas(answered)...

they last totalizing fields doesn´t filter anything,...

try to Busca Avancada (adv search) and put the 12/09/2008 day...it wont filter...the ligacoes field ok, it filters, but not unicos or atendidas....
C ya
Thx in advance
here´s the mysql query
SELECT

clid,

calldate,

date(calldate) AS `data`,

clid AS clid3,

COUNT() AS ligacoes,

(select count(distinct(ultimos10)) from cdrdiaagrupand disposition="answered") AS unicos,

(select count(
) from cdrdiaagrup where disposition = "answered" and dia=date(calldate)) AS atendidas

FROM cdrdiaagrup

GROUP BY clid

ORDER BY ligacoes DESC

Yuri,

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

J
Jane 10/20/2008

Yuri,
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

B
bozzo author 11/15/2008

Hello everyone, for forum "loyalty" I will post how I did my workaround this problem
The thing is, advanced search doesn´t filter subqueries...

So I needed a query that used the MAIN query only.
My tablename is cdrdiaagrup.
And this:

(select count(*) from cdrdiaagrup where disposition = "answered" and dia=date(calldate)) AS atendidas


I turned into this:

sum((IF(disposition="answered", "1", "0"))) as atendidas


And yes, it was so much faster too!
Good luck!