January 21st, 2004, 02:45 PM
Question about Duplicate Records
Can someone help me?
Basically i have a table with 37,000 records. Each record has the person reponsible name. Each name is used more than once. Whenever I preform the following SQL Query:
SELECT YKPC_EXT_Orders.ACCOUNTANT, YKPC_EXT_Orders.FULL_NAME
It displays a table with their full name and userid like its supposed to but it displays duplicates of each name. Say that persons name was in 30 records, it would display their name 30 times. Is there any way i could put a constraint on my SQL statement so when i run the query, it wont show each name more than once??
January 21st, 2004, 05:13 PM
SELECT DISTINCT ykpc_ext_orders.accountant,
But this is just fighting the symptoms of a bad database design.
Put your accountants into a separate table with user id and full name, and then store the user_id in the ykpc_ext_orders table. This is called "normalizing"