CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Subquery inMySQL syntax

Print topic Send  topic

Author Message
mkm

Posts: 10
Posted: 02/08/2005, 9:07 AM

Hi,

I have a query with subquery in WHERE clause:

SELECT tab_zm_dok.zmId

FROM tab_zm_dok
LEFT JOIN crm.tab_zm_pozycje ON tab_zm_dok.zmId = crm.tab_zm_pozycje.zmId

WHERE
SUM(tab_zm_dok.Szt) > (SELECT SUM(magazyn.tab_zm_pozycje.Szt) FROM magazyn.tab_zm_pozycje WHERE magazyn.tab_zm_pozycje.zmId = tab_zm_dok.zmId)

GROUP BY tab_zm_dok.zmId

I know this is the right query in MySQL, but CCS makes php code like this one:

...
$this->CountSQL = "SELECT COUNT(*) FROM magazyn.tab_zm_pozycje WHERE magazyn.tab_zm_pozycje.zamId = tab_zm_dok.zmId) " .
"GROUP BY tab_zm_dok.zmId";
...

and on the page I have an error:

Database error: Invalid SQL: SELECT COUNT(*) FROM magazyn.tab_zm_pozycje WHERE magazyn.tab_zm_pozycje.zamId = tab_zm_dok.zmId) GROUP BY tab_zm_dok.zmId
MySQL Error: 1064 (Something is wrong in your syntax obok ') GROUP BY tab_zm_dok.zmId' w linii 1)
Session halted.

I know that CCS makes count query to examine the database, but in this moment this is wrong query.

Have You any idea to solve this problem ?

Best regards
View profile  Send private message
peterr


Posts: 5971
Posted: 02/08/2005, 10:32 AM

Looks like some part of code is locked, possibly due to manual code modifications. I recommend that you delete the file PageName.php (where PageName is the name of your page), then CCS should be able to regenerate it correctly when you publich again. (please backup your project first)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mkm

Posts: 10
Posted: 02/08/2005, 2:00 PM

:-/
It dosn't work. I think the code generator make a mistake, when he try to calculate the countSQL query from the main query.
View profile  Send private message
peterr


Posts: 5971
Posted: 02/08/2005, 2:05 PM

You could try contacting the support and attach that page, so that we could analyze this issue in more detail.
Alternatively, you can use CountSQL property to specify correct SQL. See:
http://docs.codecharge.com/studio/html/Components/RTPro...P/CountSQL.html
http://forums.codecharge.com/search.php?s_keyword=ds-%3...or=&s_forum[]=5
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mkm

Posts: 10
Posted: 02/08/2005, 2:57 PM

:-D
Yes it is. Thank You very much.

Good day (in Poland is exactly 0.00 now :) )
MKM

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.