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

 Reporting - I need to add a field - please read explanation

Print topic Send  topic

Author Message
lulazz

Posts: 29
Posted: 08/02/2007, 5:15 AM

Hi,
I created a report and everything is fine, now I need to add a field....
Probabily the best thing to explain what I need is showing you the SQL for the report

  
SELECT s_pazienti.data, pazienti.nominativo, pazienti.sesso,pazienti. telefono, pazienti.usl, pazienti.cartella, datidoc_car.valore, pazienti.reparto  
FROM datidoc_car LEFT JOIN (a_pazienti INNER JOIN (pazienti INNER JOIN s_pazienti ON  
pazienti.seriale = s_pazienti.codice) ON  
a_pazienti.seriale = pazienti.codice) ON  
datidoc_car.riferimento = pazienti.seriale  
WHERE ( s_pazienti.servizio=18 )  
AND ( datidoc_car.codice=23 )  
AND ( pazienti.tipo in ('D','H') )  
AND ( pazienti.stato='A' )  
group by 8,7,5,6,4,3,2,1  
order by reparto, valore DESC, s_pazienti.data  
in the same query I need to retrieve datidoc_car.valore for datidoc_car.codice=8

if were writing a php program without CCS I would do 2 queries one as above (plus getting the value of pazienti.seriale) and the second one would simply be
  
SELECT valore from datidoc_car  
WHERE datidoc_car.codice=8   
AND riferimento=$seriale  

and use all the fields to create a table
How can I do this with CCS?
Also since I am not proficient with SQL would it be possible to do it in a single query?
Thanks and sorry for the long post
View profile  Send private message
lulazz

Posts: 29
Posted: 08/02/2007, 1:39 PM

I found my own solutions...
subquery
  
SELECT s_pazienti.data, nominativo, sesso, telefono, usl, cartella, valore, reparto, (select valore from datidoc_car  
WHERE datidoc_car.codice=8 AND riferimento=pazienti.seriale) as v2  
FROM datidoc_car LEFT JOIN (a_pazienti INNER JOIN (pazienti INNER JOIN s_pazienti ON  
pazienti.seriale = s_pazienti.codice) ON  
a_pazienti.seriale = pazienti.codice) ON  
datidoc_car.riferimento = pazienti.seriale  
WHERE ( s_pazienti.servizio=18 )  
AND ( datidoc_car.codice =23 )  
AND ( pazienti.tipo in ('D','H') )  
AND ( pazienti.stato='A' )  
group by reparto,7,5,6,4,3,2,1,9  
order by reparto, valore DESC, s_pazienti.data  
 
this way it works perfectly
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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