CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Count PHP MySQL

Print topic Send  topic

Author Message
Herve
Posted: 10/08/2003, 12:43 AM

Hi,

I created a grid with a selection of fields.
For each line output of this selection, I would like to make another query to display a number of entries from another table with a criteria which will contain values coming from the first request.

EXAMPLE :

First request :
select table1.field1, table1.field2 from table1

For each line in the result, another query :
select count(*) as nb from table2 where table2.field1 = (value of table1.field1)

And the display :
1. table1.field1 | table1.field2 | nb
2. ....
3. ....
etc.

Hope it is clear ...

Any Idea ?
kevina
Posted: 10/08/2003, 12:43 PM

Table orders has a status field and 'C' means the order has been processed so:

SELECT orders.orderid,customer, count( * ) FROM order_details LEFT JOIN orders ON order_details.orderid = orders.orderid WHERE orders.status = 'C' GROUP BY orderid

Displays the order id, customer and number of products per order.

   


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.