Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rows Number Count

Status
Not open for further replies.

Benouche

Programmer
Aug 6, 2002
48
FR
Hello,

let's say I have 2 tables :
- Customer table
- Product table

Cardinality: One customer can have 1 or more products

I'd like to create two indicators giving me the number of customers and the corresponding number of products.

I used till now the 'Count' function on a field of Customer and Product Table. But if I make a query on both product and Customer table, my Customer_Number get the whole number of lines (i.e Product_Number).

Which function should I use ???

Please help !
Thanx in advance !!!

Benouche
 
Hello Benouche,

Simply counting objects will cause the number of records retrieved to be displayed (duplicates will not be seen as one) At SQL level this is corrected by using the 'distinct'clause to get a count of the individual entries.

Alternative, with counting objects at universe level:

At report level this is done automatically. A SQL like:

SELECT
BIKE.CUSTOMER,
ITEM.ITEM_ID
FROM
BIKE,
ITEM
WHERE
( ITEM.ITEM_ID=BIKE.ITEM )

will give you a table with all records. If you apply the count function in these columns BO shows the distinct count.
Simply fold the table (it is in the general tab of format --> table ) and you have the result you need T. Blom
Information analist
Shimano Europe
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top