I am writing a query in SQL server2005. This is returning me a duplicate rows in the result. Can i eliminate this duplication with a particular column as the key?
You can use SELECT DISTINCT
to eliminate duplicates, as has been advised in other comments, and it may work well enough for now, but you may be begging for future trouble. All too frequently, if you cannot get a unique result without SELECT DISTINCT
, your database model has been denormalized too far, and your queries can get bogged down by retrieving and then eliminating a large number of duplicates. (However, of course, normalizing an existing database schema is rarely trivial...)
Without more information on the schema and the query it's impossible to tell whether SELECT DISTINCT
is an acceptable workaround, or whether there simply is a better join statement.