Click here to Skip to main content
15,922,427 members
Please Sign up or sign in to vote.
2.50/5 (4 votes)
See more:
My table data looks like this:

emphead-tablename
====================
empid ename
1 Jayakumar <br />
2 David <br />
3 Kutty


empdet-tablename
===================
id empid name amt
1 1 Jayakumar 4500 <br />
2 1 Jayakumar 9500 <br />
3 3 kutty 2500


I need output like this:

1 1 jayakumar 9500 <br />
3 3 kutty 2500
Posted
Updated 14-Jul-11 4:34am
v2
Comments
Joan M 14-Jul-11 10:23am    
Houstooon we have a problem... :) Shilpa-pandit, you should tell us which language are you useing... of course we know you are using SQL and that you have some data in tables... now... which software are you using in order to show that data? C, C++, HTML, PHP? Then we will be able to give you some advice...
[no name] 14-Jul-11 10:49am    
Does it really matter if she uses C or C++ or HTML for the front-end? All you have to do is to give her the SQL query that will produce the desired output.
Joan M 14-Jul-11 10:55am    
Well given the question made I've understood that the OP wants to "show" the data... and in order to show it... the OP doesn't need only a SQL query... probably I've misunderstood the thing...
shilpa-pandit 14-Jul-11 20:30pm    
dear sir
we are used asp.net

1 solution

Try
SELECT empid,name,  MAX(amt) 
FROM employees
GROUP BY empid;
 
Share this answer
 
v2
Comments
Uday P.Singh 14-Jul-11 14:26pm    
my 5!
Abhinav S 15-Jul-11 0:55am    
Thanks.

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