Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to find more than one record?

Author  Topic 

kapinjal
Starting Member

2 Posts

Posted - 2002-03-20 : 09:09:10
hi guys..

its not much complicated..but i m confused..

i got a table "purchase" with fields

purchid,fk_memberid,fk_prodid, price,purchdate,receipt

fk_memberid is a foreign key to member table
fk_prodid is a foreign key to product table

now if a memberid = 1 is for instance Jack buy a "shirt" (fk_prodid = 20)on 01/01/2002, again 12/02/2002 & 20/03/2002

i got few members who buy the same product at different time!!

now i want to find such users details from purchases table ...

i guess i made it pretty clear...

any help out there?

cheers


davidpardoe
Constraint Violating Yak Guru

324 Posts

Posted - 2002-03-20 : 09:15:51
select fk_member_id,fk_prodid,count(*)
from purchase
group by fk_member_id,fk_prodid
having count(*)>1

============
The Dabbler!
Go to Top of Page
   

- Advertisement -