Click here to Skip to main content
16,011,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
"INSERT INTO temp SELECT mobno,telecaller FROM import GROUP BY mobno HAVING COUNT(id) > 1"


This query run successfully.
I have following table :
mobno telecaller
103 XYZ
104 ABC
105 LMN
103 LMN
By using above query :
SQL
"INSERT INTO temp SELECT mobno,telecaller FROM import GROUP BY mobno HAVING COUNT(id) > 1";

i am getting output:
mobno telecaller
103 LMN
But I just want it in the following format:
mobno telecaller
103 XYZ
THAT MEANS I WANT FIRST DUPLICATE ENTRY NOT LAST....
what i have to do ...?
Posted
Updated 10-Jul-12 22:23pm
v2
Comments
project virus 11-Jul-12 4:10am    
but mobno is a part of group by clause..it give me the same value of only 'mobno'
santosha epili 11-Jul-12 4:19am    
all columns which are part of select clause must be either a part of aggregate function or a part of group by clause in group by statements
project virus 11-Jul-12 4:30am    
but I want duplicate entries of only one column
santosha epili 11-Jul-12 4:34am    
Column 'import.telecaller' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.


your query gives me this error

1 solution

1st you take the search result in datatable.then do the search operation on datatable and extracted result in array list.
 
Share this answer
 
Comments
project virus 11-Jul-12 4:13am    
sorry.I want those result from query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900