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!

Show double fields

Status
Not open for further replies.

CSOP

Technical User
Sep 26, 2003
9
GB
Hi There,

I'm having trouble with some data manipulation and hope someone out there can help?

I've got a table which has fields:
customer_number
account_number,
address,
currency

A customer number is unique to each customer, however a customer can have more than one account associated with their number. IE A UK account, US account, savings, current.....

I want to be able to run a query which will provide me with the customer numbers which have more than one account.

ie

where customer_number 'appears more than once'

Please help
Many thanks

 
Try this:
Code:
SELECT 	customer_number
FROM    ACCOUNTS
GROUP BY customer_number
HAVING  COUNT(customer_number) > 1

~Brian
 
select customer_number, account_number
from table
group by customer_number
having count(customer_number) > 1

will this work?
dlc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top