[PHP-DB] Querying two tables

2002-12-14 Thread Cesar Aracena

Hi all,

I have several tables from which I have to fetch certain products 
categories based on customer selection. The tables are as follows:

Table 1 - Categories
catid (autonum)
catname

Table 2 - Sub categories
subcatid (autonum)
subcatname

Table 3 - Products
prodid (autonum)
prodname

Table 4 - Relationships
Catid
Subcatid
Prodid

Now, the question is how to fetch all the sub-categories let's say that
are related to category 0001. I know it's as simple as relating two
tables in one query, but I don't remember how. Any help appreciated.


Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] SUM(colname)

2003-01-17 Thread Cesar Aracena
Hi all,

I'm trying to add all the values from the same column in MySQL with a
query like this:

SELECT SUM(colname) WHERE value = 'value'

But then I can't output it on the screen correctly. I've tried to put
all the results into an array and then make an array_sum($arrayname) and
it gives me exactly the double of what it should... any suggestions? By
the way, the column I'm trying to add is a DOUBLE 6,2.

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Count AND sum columns values

2003-01-20 Thread Cesar Aracena
Hi all,

I have this table which stores products and quantities ordered by
customers, and for billing purposes, I need to fetch not only how many
products but also how many where ordered for each one but not detailed,
but as one big result, so later I can charge for individual gift
packages and stuff... How can I do this in a simple way?

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php