C# .NET - select unique contact no from sql query

Asked By Priyanka on 02-Jul-13 11:52 AM
i am using query like below. I dont want to repeat contactno records. Only user with one phoneno should be shown.. i am using query like below but it is giving error like You tried to execute a query that does not include the specified expression 'cust_name' as part of an aggregate function.

 
new OleDbCommand("Select contactno,cust_name,gender,age,address,profession,nationality from table1 group by contactno", con);
Robbe Morris replied to Priyanka on 02-Jul-13 11:52 AM
select distinct contactno, etc....

DISTINCT works across all columns in the SELECT statement.