Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem In Queries

Author  Topic 

ankur_bhargava2000
Starting Member

4 Posts

Posted - 2005-07-13 : 14:32:01
hi every one

i am facing a little bit of problem in solving the queries

can anyone provide me the solution of these queries

i have a table called employee
feilds are
1.empid
2.empname
3.salary
4.city
and i want the following queries solved

1. duplicate employee name with their phone no
2. max salary row from the table
3. second highest salary from the table
4. empname getting highest salary in cities group by city

please provide me the solution of above and also tell me the
site where i can get different advanced queries so that i could understand
them.


thanking u

ankur bhargava

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-13 : 14:42:10
Sorry but we do not answer homework questions here.

I'll give you hints though.

1. GROUP BY with HAVING will work
2. MAX
3. MAX with a WHERE clause
4. Your teacher practically gave you the answer with this one

Tara
Go to Top of Page

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-07-13 : 16:32:08

http://vyaskn.tripod.com/programming_faq.htm



With Regards
Sreenivas Reddy B
Go to Top of Page

ankur_bhargava2000
Starting Member

4 Posts

Posted - 2005-07-15 : 02:18:41
hi

this is not a home work i am trying on these queries
but not able to solve these queries. i do not know how to use aggrgate functions in
having clause

for ex i want to know the complete detail of emp gettting maximum salary

i am writing this query but this doesnt work for me

SELECT Tbl_Emp.EmpId, Tbl_Emp.EmpName, Tbl_Emp.City, Max(Tbl_Emp.Salary) AS [Max Of Salary]
FROM Tbl_Emp
GROUP BY Tbl_Emp.EmpId, Tbl_Emp.EmpName, Tbl_Emp.City

so any one can provide me the solutions of above queries
i will be greatful


with thanks

ankur
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-15 : 02:25:27
you need to try subqueries and/or joins

--------------------
keeping it simple...
Go to Top of Page

ankur_bhargava2000
Starting Member

4 Posts

Posted - 2005-07-19 : 14:17:01
hi all

ys i know these queries r easier for one who know.
but i am learning sql self therefore i dont know these queries and even dont know to use
query builders.so if any one can help me out of this
i will be thankful

ankur
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-20 : 01:34:55
See Books On Line for Subquery, Joins, Max, Having

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -