Home » RDBMS Server » Server Administration » Sql statement
Sql statement [message #370810] Thu, 10 February 2000 13:34 Go to next message
newcomer
Messages: 3
Registered: February 2000
Junior Member
I have a table like this
Product
pno
p1
p1
p1
p2

I want a sel statement which can display a output
as

p1 - 3 - 2
p2 - 1 - 2

where 2 stands for 2 unique records (p1,p2)
Re: Sql statement [message #370819 is a reply to message #370810] Fri, 11 February 2000 00:22 Go to previous messageGo to next message
Atavur Rahaman S.A
Messages: 23
Registered: January 2000
Junior Member
Hello,

Good Day!

Hope so this'll work.....

SQL> Select Product_Id, Count(*) Number of Products, Count(*)-1 Redundant Products From
Table_Name Group By Product_id;

Regards

Atavur Rahaman S.A
Re: Sql statement [message #370835 is a reply to message #370810] Mon, 14 February 2000 15:31 Go to previous message
Suresh
Messages: 189
Registered: December 1998
Senior Member
try this

select a.pno,count(distinct(a.rowid)),count(distinct(b.pno)) from product a,product b
group by a.pno

Suresh
Previous Topic: Re: Why so slow?
Next Topic: SQL
Goto Forum:
  


Current Time: Tue Oct 20 10:01:25 CDT 2020