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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count unqiue sub item

Status
Not open for further replies.

Wiszh

Programmer
Aug 3, 2000
134
US
HI,

I have a many to many relationship. I want to count the number of item that participate, by the number of the other part of the relationship.
For example:
I have a list of orders, each order can have none or several options. How do I count the orders, so that each set of options is covered. Those that have option 1, but not 2, those that have option 2, but not , those that have one and two but not three. etc.

Thanx
Wiszh
 
Why not try the following :

select option1, option2, option3, count(order)
from filename
group by option1, option2, optiont3

OUTPUT:
OPT1 OPT2 OPT3 COUNT ( ORDER )
0 0 1 2
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 3


I hope this is what you wanted

Regards,
Bernd
 
Is this Oracle?
give a sample of what order, option1, option2, option3 look like. Describe the tables/columns.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top